| 1 |
# ansible-aci |
| 2 |
|
| 3 |
## Description |
| 4 |
|
| 5 |
The `ansible-aci` project provides an Ansible collection for managing and automating your Cisco Application Centric Infrastructure (ACI) environment. It consists of a set of modules and roles for performing tasks related to ACI. |
| 6 |
|
| 7 |
See the [cisco.aci collection index](https://galaxy.ansible.com/ui/repo/published/cisco/aci/content/) for a full list of modules and plugins. |
| 8 |
|
| 9 |
## Requirements |
| 10 |
|
| 11 |
- Ansible v2.16 or newer |
| 12 |
- Python v3.11 or newer |
| 13 |
|
| 14 |
Follow the [Installing Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) guide for detailed instructions. |
| 15 |
|
| 16 |
## Installation |
| 17 |
|
| 18 |
Before using this collection, you need to install it with the Ansible Galaxy command-line tool: |
| 19 |
|
| 20 |
```sh |
| 21 |
ansible-galaxy collection install cisco.aci |
| 22 |
``` |
| 23 |
|
| 24 |
You can also include this collection in a `requirements.yml` file and install it with: |
| 25 |
|
| 26 |
```sh |
| 27 |
ansible-galaxy collection install -r requirements.yml |
| 28 |
``` |
| 29 |
|
| 30 |
Using the following `requirements.yml` format: |
| 31 |
|
| 32 |
```yaml |
| 33 |
collections: |
| 34 |
- name: cisco.aci |
| 35 |
``` |
| 36 |
|
| 37 |
Note that if you install any collections from Ansible Galaxy, they will not be upgraded automatically when you upgrade the Ansible package. |
| 38 |
To upgrade the collection to the latest available version, run the following command: |
| 39 |
|
| 40 |
```sh |
| 41 |
ansible-galaxy collection install cisco.aci --upgrade |
| 42 |
``` |
| 43 |
|
| 44 |
You can also install a specific version of the collection. For example, to install version 1.0.0, use the following syntax: |
| 45 |
|
| 46 |
```sh |
| 47 |
ansible-galaxy collection install cisco.aci:==1.0.0 |
| 48 |
``` |
| 49 |
|
| 50 |
See [using Ansible collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details. |
| 51 |
|
| 52 |
### Latest Build |
| 53 |
|
| 54 |
Follow these instructions to get the latest collection. |
| 55 |
|
| 56 |
#### First Approach - Build From Source Code |
| 57 |
|
| 58 |
Clone the ansible-aci repository. |
| 59 |
|
| 60 |
```sh |
| 61 |
git clone https://github.com/CiscoDevNet/ansible-aci.git |
| 62 |
``` |
| 63 |
|
| 64 |
Go to the ansible-aci directory |
| 65 |
|
| 66 |
```sh |
| 67 |
cd ansible-aci |
| 68 |
``` |
| 69 |
|
| 70 |
Pull the latest master on your aci |
| 71 |
|
| 72 |
```sh |
| 73 |
git pull origin master |
| 74 |
``` |
| 75 |
|
| 76 |
Build and Install a collection from source |
| 77 |
|
| 78 |
```sh |
| 79 |
ansible-galaxy collection build --force |
| 80 |
ansible-galaxy collection install cisco-aci-* --force |
| 81 |
``` |
| 82 |
|
| 83 |
#### Second Approach - Download From Latest CI Build |
| 84 |
|
| 85 |
Go to [ansible-aci Actions](https://github.com/CiscoDevNet/ansible-aci/actions/workflows/ansible-test.yml?query=branch%3Amaster) and select the latest CI build. |
| 86 |
|
| 87 |
Under Artifacts download collection suffixed with the latest version of Ansible (eg. `collection-stable-2.17`) and unzip it using Terminal or Console. |
| 88 |
|
| 89 |
*Note: The collection file is a zip file containing a tar.gz file. We recommend using CLI because some GUI-based unarchiver might unarchive both nested archives in one go.* |
| 90 |
|
| 91 |
Install the unarchived tar.gz file |
| 92 |
|
| 93 |
```sh |
| 94 |
ansible-galaxy collection install cisco-aci-1.0.0.tar.gz —-force |
| 95 |
``` |
| 96 |
|
| 97 |
## Use Cases |
| 98 |
|
| 99 |
Once the collection is installed, you can use it in a playbook by specifying the full namespace path to the module, plugin and/or role. |
| 100 |
|
| 101 |
### Adding a new EPG |
| 102 |
|
| 103 |
```yml |
| 104 |
- hosts: aci |
| 105 |
gather_facts: no |
| 106 |
|
| 107 |
tasks: |
| 108 |
- name: Add a new EPG |
| 109 |
cisco.aci.aci_epg: |
| 110 |
hostname: apic |
| 111 |
username: admin |
| 112 |
password: SomeSecretPassword |
| 113 |
tenant: production |
| 114 |
ap: intranet |
| 115 |
epg: web_epg |
| 116 |
description: Web Intranet EPG |
| 117 |
bd: prod_bd |
| 118 |
delegate_to: localhost |
| 119 |
``` |
| 120 |
|
| 121 |
## Optimizing Playbooks |
| 122 |
|
| 123 |
There are two main methods to optimize the execution of ACI modules in your playbooks. |
| 124 |
|
| 125 |
1. Using the ACI HTTPAPI plugin |
| 126 |
1. Using the `suppress_` options |
| 127 |
|
| 128 |
To find out more about optimizing playbook execution, please refer to the [Optimizing Playbooks](docs/optimizing.md) documentation. |
| 129 |
|
| 130 |
## Testing |
| 131 |
|
| 132 |
Integration tests for each module in the `cisco.aci` collection are executed on the following ACI versions: |
| 133 |
|
| 134 |
- 4.2 |
| 135 |
- 5.2 |
| 136 |
- 6.0 |
| 137 |
|
| 138 |
## Contributing |
| 139 |
|
| 140 |
Ongoing development efforts and contributions to this collection are tracked as issues in this repository. |
| 141 |
|
| 142 |
We welcome community contributions to this collection. If you find problems, need an enhancement or need a new module, please open an issue or create a PR against the [Cisco ACI collection repository](https://github.com/CiscoDevNet/ansible-aci/issues). |
| 143 |
|
| 144 |
## Support |
| 145 |
|
| 146 |
This collection supports any ACI version within the Last Day of Support (LDOS) date. |
| 147 |
|
| 148 |
Certain modules and options in the collection are only available from specific versions of ACI. The versions that a module or option supports are documented in the individual module documentation. |
| 149 |
|
| 150 |
To find EOL announcements for ACI versions, refer to the [End-of-Life and End-of-Sale Notices](https://www.cisco.com/c/en/us/products/cloud-systems-management/application-policy-infrastructure-controller-apic/eos-eol-notice-listing.html) page. |
| 151 |
|
| 152 |
## Release Notes |
| 153 |
|
| 154 |
See the [Changelog](https://github.com/CiscoDevNet/ansible-aci/blob/master/CHANGELOG.rst) for full release notes. |
| 155 |
|
| 156 |
## Related Information |
| 157 |
|
| 158 |
For further information and guides, refer to the following: |
| 159 |
|
| 160 |
- [Cisco ACI DevNet Documentation](https://developer.cisco.com/docs/aci/ansible/#cisco-aci-ansible-modules) |
| 161 |
- [Automating ACI using Ansible](https://developer.cisco.com/docs/nexus-as-code/aci-with-ansible/#automating-aci-using-ansible) |
| 162 |
- [ACI Programmability Learning Lab](https://developer.cisco.com/learning/tracks/aci-programmability/) |
| 163 |
|
| 164 |
## License Information |
| 165 |
|
| 166 |
This collection is licensed under the [GNU General Public License v3.0](https://github.com/CiscoDevNet/ansible-aci/blob/master/LICENSE) |