-
Notifications
You must be signed in to change notification settings - Fork 108
[minor_change] Added Playbook Optimizing documentation #641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| # Optimizing Playbooks | ||
|
|
||
| By using all of the following optimizations together its estimated that playbook execution time can be reduced by up to 60% compared to default behavior. | ||
|
|
||
| ## Using the ACI HTTPAPI plugin | ||
|
|
||
| The Ansible ACI HTTPAPI plugin instructs Ansible how to interact with an APIC's HTTP based API and execute tasks on the APIC. | ||
|
|
||
| ### Benefits | ||
|
|
||
| - The ACI login credentials and ansible variables can stay in the inventory. | ||
| - Logs in once and executes subsequent tasks without requiring additional logins when using password-based authentication. | ||
| - Automatically refreshes password-based logins if the token expires during the playbook. | ||
| - Assists with overcoming rate limiting on logins. | ||
| - Leverages APIC's high availability by allowing a list of APIC hosts to be defined as a single ansible host. | ||
|
|
||
| ### Enabling the plugin | ||
|
|
||
| The httpapi plugin can be enabled by setting the following variables: | ||
|
|
||
| ```ini | ||
| ansible_connection=ansible.netcommon.httpapi | ||
| ansible_network_os=cisco.aci.aci | ||
| ``` | ||
|
|
||
| Instead of using `hostname`, `username` & `password` in the playbook, the following variables can be used in the inventory. | ||
|
|
||
| ```ini | ||
| ansible_user=apicUser | ||
| ansible_password="SomeSecretPassword" | ||
| ``` | ||
|
|
||
| The `ansible_host` variable can contain one or more APIC hosts separated by a comma. If multiple hosts are defined the plugin will try executing tasks on the hosts in the order listed until one completes or they all fail. | ||
|
|
||
| ```ini | ||
| single_apic ansible_host=apic.host | ||
| cluster_apic ansible_host=apic1.host,apic2.host,apic3.host | ||
| ``` | ||
|
|
||
| Signature-based authentication can be specified in the inventory. | ||
|
|
||
| ```ini | ||
| ansible_httpapi_session_key={'admin': "{{ lookup('file', 'admin.key')}}"} | ||
| ``` | ||
|
|
||
| > [!NOTE] | ||
| > `ansible_httpapi_session_key` takes precedence over `ansible_password`. | ||
|
|
||
| > [!TIP] | ||
| > Using signature-based authentication with or without ACI HTTPAPI enabled has the same execution time benefit. | ||
|
|
||
| ### Full Example Inventory using ACI HTTPAPI plugin | ||
|
|
||
| ```ini | ||
| [aci] | ||
| single_apic ansible_host=apic.host | ||
| cluster_apic ansible_host=apic1.host,apic2.host,apic3.host | ||
|
|
||
| [aci:vars] | ||
| ansible_user=admin | ||
| ansible_password="SomeSecretPassword" | ||
| ansible_connection=ansible.netcommon.httpapi | ||
| ansible_network_os=cisco.aci.aci | ||
| ``` | ||
|
|
||
| ## Using the `suppress_` options | ||
|
|
||
| Two options are available to users on all ACI modules to assist with optimizing playbook performance by reducing API calls. These options can increase playbook performance at the expense of suppressing some features of the modules. | ||
|
|
||
| ### `suppress_previous` | ||
|
|
||
| If enabled, a GET call to check previous object state will not be sent before a POST update to APIC. | ||
|
|
||
| > [!WARNING] | ||
| > This causes the previous return value to be empty. The previous state of the object will not be checked and POST update calls to APIC will contain all properties specified in the task. | ||
|
|
||
| #### `suppress_previous` Aliases | ||
|
|
||
| - `no_previous` | ||
| - `ignore_previous` | ||
|
|
||
| #### `suppress_previous` Example | ||
|
|
||
| ```yml | ||
| - hosts: aci | ||
| gather_facts: no | ||
|
|
||
| tasks: | ||
| - name: Add a new EPG | ||
| cisco.aci.aci_epg: | ||
| tenant: production | ||
| ap: intranet | ||
| epg: web_epg | ||
| description: Web Intranet EPG | ||
| bd: prod_bd | ||
| suppress_previous: true | ||
| ``` | ||
|
|
||
| ### `suppress_verification` | ||
|
|
||
| If enabled, a verifying GET call to check current object state will not be sent after a POST call to APIC. | ||
|
|
||
| > [!WARNING] | ||
| > This causes the current return value to be set to the proposed value. The current object state including default values will be unverifiable until another task executes for the same object. | ||
|
|
||
| #### `suppress_verification` Aliases | ||
|
|
||
| - `no_verification` | ||
| - `no_verify` | ||
| - `suppress_verify` | ||
| - `ignore_verify` | ||
| - `ignore_verification` | ||
|
|
||
| #### `suppress_verification` Example | ||
|
|
||
| ```yml | ||
| - hosts: aci | ||
| gather_facts: no | ||
|
|
||
| tasks: | ||
| - name: Add a new EPG | ||
| cisco.aci.aci_epg: | ||
| tenant: production | ||
| ap: intranet | ||
| epg: web_epg | ||
| description: Web Intranet EPG | ||
| bd: prod_bd | ||
| suppress_verification: true | ||
| ``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.