From 6534e6a45066fdae7b9ab6c0781f1e6d990b04cd Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Tue, 20 Feb 2018 03:27:17 +0100 Subject: [PATCH] ACI: Add missing examples to module docs (#36417) This PR includes: - A cleanup of documentation examples for ACI modules - A small fix in aci_rest integration test --- .../modules/network/aci/aci_aep_to_domain.py | 39 +++++- .../network/aci/aci_config_rollback.py | 10 +- .../modules/network/aci/aci_contract.py | 46 +++++-- .../aci/aci_contract_subject_to_filter.py | 49 ++++++-- .../network/aci/aci_domain_to_encap_pool.py | 47 ++++++- .../network/aci/aci_epg_to_contract.py | 46 ++++++- .../modules/network/aci/aci_epg_to_domain.py | 45 ++++++- .../network/aci/aci_firmware_source.py | 34 +++--- .../aci_interface_policy_leaf_policy_group.py | 25 ++-- ..._selector_to_switch_policy_leaf_profile.py | 12 +- lib/ansible/modules/network/aci/aci_rest.py | 34 +++--- .../network/aci/aci_static_binding_to_epg.py | 103 +++++++++++++++- .../network/aci/aci_switch_leaf_selector.py | 16 +-- .../aci/aci_switch_policy_leaf_profile.py | 12 +- .../aci_switch_policy_vpc_protection_group.py | 115 ++++++++++++++++-- .../modules/network/aci/aci_taboo_contract.py | 24 ++-- .../aci/aci_tenant_action_rule_profile.py | 6 +- .../network/aci/aci_tenant_span_dst_group.py | 6 +- .../network/aci/aci_tenant_span_src_group.py | 16 +-- .../aci_tenant_span_src_group_to_dst_group.py | 14 +-- .../aci_epg_to_contract/tasks/main.yml | 2 +- 21 files changed, 566 insertions(+), 135 deletions(-) diff --git a/lib/ansible/modules/network/aci/aci_aep_to_domain.py b/lib/ansible/modules/network/aci/aci_aep_to_domain.py index 228000cd62..0112a49694 100755 --- a/lib/ansible/modules/network/aci/aci_aep_to_domain.py +++ b/lib/ansible/modules/network/aci/aci_aep_to_domain.py @@ -54,7 +54,44 @@ options: extends_documentation_fragment: aci ''' -EXAMPLES = r''' # ''' +EXAMPLES = r''' +- name: Add AEP to domain binding + aci_aep_to_domain: &binding_present + host: apic + username: admin + password: SomeSecretPassword + aep: test_aep + domain: phys_dom + domain_type: phys + state: present + +- name: Remove AEP to domain binding + aci_aep_to_domain: &binding_absent + host: apic + username: admin + password: SomeSecretPassword + aep: test_aep + domain: phys_dom + domain_type: phys + state: absent + +- name: Query our AEP to domain binding + aci_aep_to_domain: + host: apic + username: admin + password: SomeSecretPassword + aep: test_aep + domain: phys_dom + domain_type: phys + state: query + +- name: Query all AEP to domain bindings + aci_aep_to_domain: &binding_query + host: apic + username: admin + password: SomeSecretPassword + state: query +''' RETURN = r''' current: diff --git a/lib/ansible/modules/network/aci/aci_config_rollback.py b/lib/ansible/modules/network/aci/aci_config_rollback.py index 4bbd9a6395..f3464f4d1b 100644 --- a/lib/ansible/modules/network/aci/aci_config_rollback.py +++ b/lib/ansible/modules/network/aci/aci_config_rollback.py @@ -97,9 +97,9 @@ EXAMPLES = r''' password: SomeSecretPassword state: preview export_policy: config_backup - snapshot: 'run-2017-08-28T06-24-01' + snapshot: run-2017-08-28T06-24-01 compare_export_policy: config_backup - compare_snapshot: 'run-2017-08-27T23-43-56' + compare_snapshot: run-2017-08-27T23-43-56 - name: Rollback Configuration aci_config_rollback: @@ -109,7 +109,7 @@ EXAMPLES = r''' state: rollback import_policy: rollback_config export_policy: config_backup - snapshot: 'run-2017-08-28T06-24-01' + snapshot: run-2017-08-28T06-24-01 - name: Rollback Configuration aci_config_rollback: @@ -119,8 +119,8 @@ EXAMPLES = r''' state: rollback import_policy: rollback_config export_policy: config_backup - snapshot: 'run-2017-08-28T06-24-01' - description: 'Rollback 8-27 changes' + snapshot: run-2017-08-28T06-24-01 + description: Rollback 8-27 changes import_mode: atomic import_type: replace fail_on_decrypt: yes diff --git a/lib/ansible/modules/network/aci/aci_contract.py b/lib/ansible/modules/network/aci/aci_contract.py index 2cbe9c121b..b445e2ba37 100644 --- a/lib/ansible/modules/network/aci/aci_contract.py +++ b/lib/ansible/modules/network/aci/aci_contract.py @@ -66,18 +66,42 @@ options: extends_documentation_fragment: aci ''' -# FIXME: Add more, better examples EXAMPLES = r''' -- aci_contract: - host: '{{ inventory_hostname }}' - username: '{{ username }}' - password: '{{ password }}' - contract: '{{ contract }}' - description: '{{ descr }}' - tenant: '{{ tenant }}' - scope: '{{ scope }}' - priority: '{{ priority }}' - target: '{{ target }}' +- name: Add a new contract + aci_contract: + host: apic + username: admin + password: SomeSecretPassword + tenant: production + contract: web_to_db + description: Communication between web-servers and database + scope: application-profile + state: present + +- name: Remove an existing contract + aci_contract: + host: apic + username: admin + password: SomeSecretPassword + tenant: production + contract: web_to_db + state: absent + +- name: Query a specific contract + aci_contract: + host: apic + username: admin + password: SomeSecretPassword + tenant: production + contract: web_to_db + state: query + +- name: Query all contracts + aci_contract: + host: apic + username: admin + password: SomeSecretPassword + state: query ''' RETURN = r''' diff --git a/lib/ansible/modules/network/aci/aci_contract_subject_to_filter.py b/lib/ansible/modules/network/aci/aci_contract_subject_to_filter.py index 84e3cfd21f..eb1cf7964c 100644 --- a/lib/ansible/modules/network/aci/aci_contract_subject_to_filter.py +++ b/lib/ansible/modules/network/aci/aci_contract_subject_to_filter.py @@ -62,15 +62,50 @@ extends_documentation_fragment: aci # FIXME: Add more, better examples EXAMPLES = r''' -- aci_subject_filter_binding: - host: '{{ inventory_hostname }}' - username: '{{ username }}' - password: '{{ password }}' - tenant: '{{ tenant }}' - contract: '{{ contract }}' - subject: '{{ subject }}' +- name: Add a new contract subject to filer binding + aci_subject_filter_binding: + host: apic + username: admin + password: SomeSecretPassword + tenant: production + contract: web_to_db + subject: test filter: '{{ filter }}' log: '{{ log }}' + state: present + +- name: Remove an existing contract subject to filter binding + aci_subject_filter_binding: + host: apic + username: admin + password: SomeSecretPassword + tenant: production + contract: web_to_db + subject: test + filter: '{{ filter }}' + log: '{{ log }}' + state: present + +- name: Query a specific contract subject to filter binding + aci_subject_filter_binding: + host: apic + username: admin + password: SomeSecretPassword + tenant: production + contract: web_to_db + subject: test + filter: '{{ filter }}' + state: query + +- name: Query all contract subject to filter bindings + aci_subject_filter_binding: + host: apic + username: admin + password: SomeSecretPassword + tenant: production + contract: web_to_db + subject: test + state: query ''' RETURN = r''' diff --git a/lib/ansible/modules/network/aci/aci_domain_to_encap_pool.py b/lib/ansible/modules/network/aci/aci_domain_to_encap_pool.py index fa18c9a718..fab88aaadc 100644 --- a/lib/ansible/modules/network/aci/aci_domain_to_encap_pool.py +++ b/lib/ansible/modules/network/aci/aci_domain_to_encap_pool.py @@ -64,7 +64,52 @@ options: extends_documentation_fragment: aci ''' -EXAMPLES = r''' # ''' +EXAMPLES = r''' +- name: Add domain to VLAN pool binding + aci_domain_to_encap_pool: + host: apic + username: admin + password: SomeSecretPassword + domain: phys_dom + domain_type: phys + pool: test_pool + pool_type: vlan + pool_allocation_mode: dynamic + state: present + +- name: Remove domain to VLAN pool binding + aci_domain_to_encap_pool: + host: apic + username: admin + password: SomeSecretPassword + domain: phys_dom + domain_type: phys + pool: test_pool + pool_type: vlan + pool_allocation_mode: dynamic + state: absent + +- name: Query our domain to VLAN pool binding + aci_domain_to_encap_pool: + host: apic + username: admin + password: SomeSecretPassword + domain: phys_dom + pool: test_pool + pool_type: vlan + pool_allocation_mode: dynamic + state: query + +- name: Query all domain to VLAN pool bindings + aci_domain_to_encap_pool: + host: apic + username: admin + password: SomeSecretPassword + domain_type: phys + pool_type: vlan + pool_allocation_mode: dynamic + state: query +''' RETURN = r''' current: diff --git a/lib/ansible/modules/network/aci/aci_epg_to_contract.py b/lib/ansible/modules/network/aci/aci_epg_to_contract.py index 5396de0f08..01af80528c 100644 --- a/lib/ansible/modules/network/aci/aci_epg_to_contract.py +++ b/lib/ansible/modules/network/aci/aci_epg_to_contract.py @@ -67,7 +67,51 @@ options: extends_documentation_fragment: aci ''' -EXAMPLES = r''' # ''' +EXAMPLES = r''' +- name: Add a new contract to EPG binding + aci_epg_to_contract: + host: apic + username: admin + password: SomeSecretPassword + tenant: anstest + ap: anstest + epg: anstest + contract: anstest_http + contract_type: provider + state: present + +- name: Remove an existing contract to EPG binding + aci_epg_to_contract: + host: apic + username: admin + password: SomeSecretPassword + tenant: anstest + ap: anstest + epg: anstest + contract: anstest_http + contract_type: provider + state: absent + +- name: Query a specific contract to EPG binding + aci_epg_to_contract: + host: apic + username: admin + password: SomeSecretPassword + tenant: anstest + ap: anstest + epg: anstest + contract: anstest_http + contract_type: provider + state: query + +- name: Query all provider contract to EPG bindings + aci_epg_to_contract: + host: apic + username: admin + password: SomeSecretPassword + contract_type: provider + state: query +''' RETURN = r''' current: diff --git a/lib/ansible/modules/network/aci/aci_epg_to_domain.py b/lib/ansible/modules/network/aci/aci_epg_to_domain.py index 8d7e4dbf58..d801f5306f 100644 --- a/lib/ansible/modules/network/aci/aci_epg_to_domain.py +++ b/lib/ansible/modules/network/aci/aci_epg_to_domain.py @@ -103,7 +103,50 @@ options: extends_documentation_fragment: aci ''' -EXAMPLES = r''' # ''' +EXAMPLES = r''' +- name: Add a new physical domain to EPG binding + aci_epg_to_domain: + host: apic + username: admin + password: SomeSecretPassword + tenant: anstest + ap: anstest + epg: anstest + domain: anstest + domain_type: phys + state: present + +- name: Remove an existing physical domain to EPG binding + aci_epg_to_domain: + host: apic + username: admin + password: SomeSecretPassword + tenant: anstest + ap: anstest + epg: anstest + domain: anstest + domain_type: phys + state: absent + +- name: Query a specific physical domain to EPG binding + aci_epg_to_domain: + host: apic + username: admin + password: SomeSecretPassword + tenant: anstest + ap: anstest + epg: anstest + domain: anstest + domain_type: phys + state: query + +- name: Query all domain to EPG bindings + aci_epg_to_domain: + host: apic + username: admin + password: SomeSecretPassword + state: query +''' RETURN = r''' current: diff --git a/lib/ansible/modules/network/aci/aci_firmware_source.py b/lib/ansible/modules/network/aci/aci_firmware_source.py index 1d0ce73bd4..52972671b0 100644 --- a/lib/ansible/modules/network/aci/aci_firmware_source.py +++ b/lib/ansible/modules/network/aci/aci_firmware_source.py @@ -58,36 +58,36 @@ extends_documentation_fragment: aci EXAMPLES = r''' - name: Add firmware source aci_firmware_source: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' + host: apic + username: admin + password: SomeSecretPassword source: aci-msft-pkg-3.1.1i.zip - url: foobar.cisco.com/download/cisco/aci/aci-msft-pkg-3.1.1i.zip + url: foo.bar.cisco.com/download/cisco/aci/aci-msft-pkg-3.1.1i.zip url_protocol: http state: present - name: Remove firmware source aci_firmware_source: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' + host: apic + username: admin + password: SomeSecretPassword source: aci-msft-pkg-3.1.1i.zip state: absent -- name: Query all firmware sources - aci_firmware_source: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - state: query - - name: Query a specific firmware source aci_firmware_source: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' + host: apic + username: admin + password: SomeSecretPassword source: aci-msft-pkg-3.1.1i.zip state: query + +- name: Query all firmware sources + aci_firmware_source: + host: apic + username: admin + password: SomeSecretPassword + state: query ''' RETURN = r''' diff --git a/lib/ansible/modules/network/aci/aci_interface_policy_leaf_policy_group.py b/lib/ansible/modules/network/aci/aci_interface_policy_leaf_policy_group.py index ce13071850..426a332ed5 100644 --- a/lib/ansible/modules/network/aci/aci_interface_policy_leaf_policy_group.py +++ b/lib/ansible/modules/network/aci/aci_interface_policy_leaf_policy_group.py @@ -111,12 +111,13 @@ options: extends_documentation_fragment: aci ''' +# TODO: Add query examples EXAMPLES = r''' -- name: creating a Port Channel (PC) Interface Policy Group +- name: Create a Port Channel (PC) Interface Policy Group aci_interface_policy_leaf_policy_group: host: apic - username: yourusername - password: yourpassword + username: admin + password: SomeSecretPassword policy_group: policygroupname description: policygroupname description lag_type: link @@ -124,33 +125,33 @@ EXAMPLES = r''' fibre_channel_interface_policy: whateverfcpolicy state: present -- name: creating a Virtual Port Channel (VPC) Interface Policy Group (no description) +- name: Create a Virtual Port Channel (VPC) Interface Policy Group (no description) aci_interface_policy_leaf_policy_group: host: apic - username: yourusername - password: yourpassword + username: admin + password: SomeSecretPassword policy_group: policygroupname lag_type: node link_level_policy: whateverlinklevelpolicy fibre_channel_interface_policy: whateverfcpolicy state: present -- name: creating a Leaf Access Port Policy Group (no description) +- name: Create a Leaf Access Port Policy Group (no description) aci_interface_policy_leaf_policy_group: host: apic - username: yourusername - password: yourpassword + username: admin + password: SomeSecretPassword policy_group: policygroupname lag_type: leaf link_level_policy: whateverlinklevelpolicy fibre_channel_interface_policy: whateverfcpolicy state: present -- name: deleting an Interface policy Leaf Policy Group +- name: Delete an Interface policy Leaf Policy Group aci_interface_policy_leaf_policy_group: host: apic - username: yourusername - password: yourpassword + username: admin + password: SomeSecretPassword policy_group: policygroupname lag_type: type_name state: absent diff --git a/lib/ansible/modules/network/aci/aci_interface_selector_to_switch_policy_leaf_profile.py b/lib/ansible/modules/network/aci/aci_interface_selector_to_switch_policy_leaf_profile.py index 8aad5dfbc8..910caef2c8 100644 --- a/lib/ansible/modules/network/aci/aci_interface_selector_to_switch_policy_leaf_profile.py +++ b/lib/ansible/modules/network/aci/aci_interface_selector_to_switch_policy_leaf_profile.py @@ -48,8 +48,8 @@ EXAMPLES = r''' - name: Associating an interface selector profile to a switch policy leaf profile aci_interface_selector_to_switch_policy_leaf_profile: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name interface_selector: interface_profile_name state: present @@ -57,8 +57,8 @@ EXAMPLES = r''' - name: Remove an interface selector profile associated with a switch policy leaf profile aci_interface_selector_to_switch_policy_leaf_profile: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name interface_selector: interface_profile_name state: absent @@ -66,8 +66,8 @@ EXAMPLES = r''' - name: Query an interface selector profile associated with a switch policy leaf profile aci_interface_selector_to_switch_policy_leaf_profile: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name interface_selector: interface_profile_name state: query diff --git a/lib/ansible/modules/network/aci/aci_rest.py b/lib/ansible/modules/network/aci/aci_rest.py index 8ba382541c..8627815f57 100644 --- a/lib/ansible/modules/network/aci/aci_rest.py +++ b/lib/ansible/modules/network/aci/aci_rest.py @@ -65,8 +65,8 @@ notes: EXAMPLES = r''' - name: Add a tenant using certifcate authentication aci_rest: - host: '{{ inventory_hostname }}' - username: '{{ aci_username }}' + host: apic + username: admin private_key: pki/admin.key method: post path: /api/mo/uni.xml @@ -75,8 +75,8 @@ EXAMPLES = r''' - name: Add a tenant using inline YAML aci_rest: - host: '{{ inventory_hostname }}' - username: '{{ aci_username }}' + host: apic + username: admin private_key: pki/admin.key validate_certs: no path: /api/mo/uni.json @@ -90,8 +90,8 @@ EXAMPLES = r''' - name: Add a tenant using a JSON string aci_rest: - host: '{{ inventory_hostname }}' - username: '{{ aci_username }}' + host: apic + username: admin private_key: pki/admin.key validate_certs: no path: /api/mo/uni.json @@ -109,8 +109,8 @@ EXAMPLES = r''' - name: Add a tenant using an XML string aci_rest: - host: '{{ inventory_hostname }}' - username: '{{ aci_username }}' + host: apic + username: admin private_key: pki/{{ aci_username}}.key validate_certs: no path: /api/mo/uni.xml @@ -120,17 +120,17 @@ EXAMPLES = r''' - name: Get tenants using password authentication aci_rest: - host: '{{ inventory_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' + host: apic + username: admin + password: SomeSecretPassword method: get path: /api/node/class/fvTenant.json delegate_to: localhost - name: Configure contracts aci_rest: - host: '{{ inventory_hostname }}' - username: '{{ aci_username }}' + host: apic + username: admin private_key: pki/admin.key method: post path: /api/mo/uni.xml @@ -139,8 +139,8 @@ EXAMPLES = r''' - name: Register leaves and spines aci_rest: - host: '{{ inventory_hostname }}' - username: '{{ aci_username }}' + host: apic + username: admin private_key: pki/admin.key validate_certs: no method: post @@ -155,8 +155,8 @@ EXAMPLES = r''' - name: Wait for all controllers to become ready aci_rest: - host: '{{ inventory_hostname }}' - username: '{{ aci_username }}' + host: apic + username: admin private_key: pki/admin.key validate_certs: no path: /api/node/class/topSystem.json?query-target-filter=eq(topSystem.role,"controller") diff --git a/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py b/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py index a8d2dc2ea2..af23b75df0 100644 --- a/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py +++ b/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py @@ -118,7 +118,108 @@ EXAMPLES = r''' ''' RETURN = r''' -# +current: + description: The existing configuration from the APIC after the module has finished + returned: success + type: list + sample: + [ + { + "fvTenant": { + "attributes": { + "descr": "Production environment", + "dn": "uni/tn-production", + "name": "production", + "nameAlias": "", + "ownerKey": "", + "ownerTag": "" + } + } + } + ] +error: + description: The error information as returned from the APIC + returned: failure + type: dict + sample: + { + "code": "122", + "text": "unknown managed object class foo" + } +raw: + description: The raw output returned by the APIC REST API (xml or json) + returned: parse error + type: string + sample: '' +sent: + description: The actual/minimal configuration pushed to the APIC + returned: info + type: list + sample: + { + "fvTenant": { + "attributes": { + "descr": "Production environment" + } + } + } +previous: + description: The original configuration from the APIC before the module has started + returned: info + type: list + sample: + [ + { + "fvTenant": { + "attributes": { + "descr": "Production", + "dn": "uni/tn-production", + "name": "production", + "nameAlias": "", + "ownerKey": "", + "ownerTag": "" + } + } + } + ] +proposed: + description: The assembled configuration from the user-provided parameters + returned: info + type: dict + sample: + { + "fvTenant": { + "attributes": { + "descr": "Production environment", + "name": "production" + } + } + } +filter_string: + description: The filter string used for the request + returned: failure or debug + type: string + sample: ?rsp-prop-include=config-only +method: + description: The HTTP method used for the request to the APIC + returned: failure or debug + type: string + sample: POST +response: + description: The HTTP response from the APIC + returned: failure or debug + type: string + sample: OK (30 bytes) +status: + description: The HTTP status from the APIC + returned: failure or debug + type: int + sample: 200 +url: + description: The HTTP url used for the request to the APIC + returned: failure or debug + type: string + sample: https://10.11.12.13/api/mo/uni/tn-production.json ''' from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec diff --git a/lib/ansible/modules/network/aci/aci_switch_leaf_selector.py b/lib/ansible/modules/network/aci/aci_switch_leaf_selector.py index ec1e9964a0..b96005861d 100644 --- a/lib/ansible/modules/network/aci/aci_switch_leaf_selector.py +++ b/lib/ansible/modules/network/aci/aci_switch_leaf_selector.py @@ -69,8 +69,8 @@ EXAMPLES = r''' - name: adding a switch policy leaf profile selector associated Node Block range (w/ policy group) aci_switch_leaf_selector: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name leaf: leaf_selector_name leaf_node_blk: node_blk_name @@ -82,8 +82,8 @@ EXAMPLES = r''' - name: adding a switch policy leaf profile selector associated Node Block range (w/o policy group) aci_switch_leaf_selector: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name leaf: leaf_selector_name leaf_node_blk: node_blk_name @@ -94,8 +94,8 @@ EXAMPLES = r''' - name: Removing a switch policy leaf profile selector aci_switch_leaf_selector: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name leaf: leaf_selector_name state: absent @@ -103,8 +103,8 @@ EXAMPLES = r''' - name: Querying a switch policy leaf profile selector aci_switch_leaf_selector: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name leaf: leaf_selector_name state: query diff --git a/lib/ansible/modules/network/aci/aci_switch_policy_leaf_profile.py b/lib/ansible/modules/network/aci/aci_switch_policy_leaf_profile.py index bb34cbe778..a627bf5b83 100644 --- a/lib/ansible/modules/network/aci/aci_switch_policy_leaf_profile.py +++ b/lib/ansible/modules/network/aci/aci_switch_policy_leaf_profile.py @@ -44,8 +44,8 @@ EXAMPLES = r''' - name: creating a Leaf Profile with description aci_switch_policy_leaf_profile: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name description: sw_description state: present @@ -53,16 +53,16 @@ EXAMPLES = r''' - name: Deleting a Leaf Profile aci_switch_policy_leaf_profile: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name state: absent - name: Query a Leaf Profile aci_switch_policy_leaf_profile: host: apic - username: someusername - password: somepassword + username: admin + password: SomeSecretPassword leaf_profile: sw_name state: query ''' diff --git a/lib/ansible/modules/network/aci/aci_switch_policy_vpc_protection_group.py b/lib/ansible/modules/network/aci/aci_switch_policy_vpc_protection_group.py index 4fd2c015c4..4107da5b32 100644 --- a/lib/ansible/modules/network/aci/aci_switch_policy_vpc_protection_group.py +++ b/lib/ansible/modules/network/aci/aci_switch_policy_vpc_protection_group.py @@ -58,9 +58,9 @@ extends_documentation_fragment: aci EXAMPLES = r''' - name: Add Explicit vPC Protection Group aci_switch_policy_vpc_protection_group: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" + host: apic + username: admin + password: SomeSecretPassword protection_group: protectiongroupname protection_group_id: 6 vpc_domain_policy: vpcdomainpolicyname @@ -70,15 +70,116 @@ EXAMPLES = r''' - name: Remove Explicit vPC Protection Group aci_switch_policy_vpc_protection_group: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" + host: apic + username: admin + password: SomeSecretPassword protection_group: protectiongroupname state: absent ''' RETURN = r''' -# +current: + description: The existing configuration from the APIC after the module has finished + returned: success + type: list + sample: + [ + { + "fvTenant": { + "attributes": { + "descr": "Production environment", + "dn": "uni/tn-production", + "name": "production", + "nameAlias": "", + "ownerKey": "", + "ownerTag": "" + } + } + } + ] +error: + description: The error information as returned from the APIC + returned: failure + type: dict + sample: + { + "code": "122", + "text": "unknown managed object class foo" + } +raw: + description: The raw output returned by the APIC REST API (xml or json) + returned: parse error + type: string + sample: '' +sent: + description: The actual/minimal configuration pushed to the APIC + returned: info + type: list + sample: + { + "fvTenant": { + "attributes": { + "descr": "Production environment" + } + } + } +previous: + description: The original configuration from the APIC before the module has started + returned: info + type: list + sample: + [ + { + "fvTenant": { + "attributes": { + "descr": "Production", + "dn": "uni/tn-production", + "name": "production", + "nameAlias": "", + "ownerKey": "", + "ownerTag": "" + } + } + } + ] +proposed: + description: The assembled configuration from the user-provided parameters + returned: info + type: dict + sample: + { + "fvTenant": { + "attributes": { + "descr": "Production environment", + "name": "production" + } + } + } +filter_string: + description: The filter string used for the request + returned: failure or debug + type: string + sample: ?rsp-prop-include=config-only +method: + description: The HTTP method used for the request to the APIC + returned: failure or debug + type: string + sample: POST +response: + description: The HTTP response from the APIC + returned: failure or debug + type: string + sample: OK (30 bytes) +status: + description: The HTTP status from the APIC + returned: failure or debug + type: int + sample: 200 +url: + description: The HTTP url used for the request to the APIC + returned: failure or debug + type: string + sample: https://10.11.12.13/api/mo/uni/tn-production.json ''' from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec diff --git a/lib/ansible/modules/network/aci/aci_taboo_contract.py b/lib/ansible/modules/network/aci/aci_taboo_contract.py index 6cbabd6c64..292ab9eaeb 100644 --- a/lib/ansible/modules/network/aci/aci_taboo_contract.py +++ b/lib/ansible/modules/network/aci/aci_taboo_contract.py @@ -58,34 +58,34 @@ extends_documentation_fragment: aci EXAMPLES = r''' - name: Add taboo contract aci_taboo_contract: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' + host: apic + username: admin + password: SomeSecretPassword tenant: ansible_test taboo_contract: taboo_contract_test state: present - name: Remove taboo contract aci_taboo_contract: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' + host: apic + username: admin + password: SomeSecretPassword tenant: ansible_test taboo_contract: taboo_contract_test state: absent - name: Query all taboo contracts aci_taboo_contract: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' + host: apic + username: admin + password: SomeSecretPassword state: query - name: Query a specific taboo contract aci_taboo_contract: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' + host: apic + username: admin + password: SomeSecretPassword tenant: ansible_test taboo_contract: taboo_contract_test state: query diff --git a/lib/ansible/modules/network/aci/aci_tenant_action_rule_profile.py b/lib/ansible/modules/network/aci/aci_tenant_action_rule_profile.py index da47a83653..bf150d070c 100644 --- a/lib/ansible/modules/network/aci/aci_tenant_action_rule_profile.py +++ b/lib/ansible/modules/network/aci/aci_tenant_action_rule_profile.py @@ -49,9 +49,9 @@ extends_documentation_fragment: aci # FIXME: Add more, better examples EXAMPLES = r''' - aci_tenant_action_rule_profile: - host: '{{ inventory_hostname }}' - username: '{{ username }}' - password: '{{ password }}' + host: apic + username: admin + password: SomeSecretPassword action_rule: '{{ action_rule }}' description: '{{ descr }}' tenant: '{{ tenant }}' diff --git a/lib/ansible/modules/network/aci/aci_tenant_span_dst_group.py b/lib/ansible/modules/network/aci/aci_tenant_span_dst_group.py index 7f23e5570f..13c9e71d2a 100644 --- a/lib/ansible/modules/network/aci/aci_tenant_span_dst_group.py +++ b/lib/ansible/modules/network/aci/aci_tenant_span_dst_group.py @@ -51,9 +51,9 @@ extends_documentation_fragment: aci # FIXME: Add more, better examples EXAMPLES = r''' - aci_tenant_span_dst_group: - host: '{{ inventory_hostname }}' - username: '{{ username }}' - password: '{{ password }}' + host: apic + username: admin + password: SomeSecretPassword dst_group: '{{ dst_group }}' description: '{{ descr }}' tenant: '{{ tenant }}' diff --git a/lib/ansible/modules/network/aci/aci_tenant_span_src_group.py b/lib/ansible/modules/network/aci/aci_tenant_span_src_group.py index 25f3108c98..c160449422 100755 --- a/lib/ansible/modules/network/aci/aci_tenant_span_src_group.py +++ b/lib/ansible/modules/network/aci/aci_tenant_span_src_group.py @@ -56,14 +56,14 @@ extends_documentation_fragment: aci EXAMPLES = r''' - aci_tenant_span_src_group: - host:"{{ inventory_hostname }}" - username:"{{ username }}" - password:"{{ password }}" - tenant:"{{ tenant }}" - src_group:"{{ src_group }}" - dst_group:"{{ dst_group }}" - admin_state:"{{ admin_state }}" - description:"{{ description }}" + host: apic + username: admin + password: SomeSecretPassword + tenant: production + src_group: "{{ src_group }}" + dst_group: "{{ dst_group }}" + admin_state: "{{ admin_state }}" + description: "{{ description }}" ''' RETURN = r''' diff --git a/lib/ansible/modules/network/aci/aci_tenant_span_src_group_to_dst_group.py b/lib/ansible/modules/network/aci/aci_tenant_span_src_group_to_dst_group.py index fb8c82503b..168280e161 100755 --- a/lib/ansible/modules/network/aci/aci_tenant_span_src_group_to_dst_group.py +++ b/lib/ansible/modules/network/aci/aci_tenant_span_src_group_to_dst_group.py @@ -50,13 +50,13 @@ extends_documentation_fragment: aci EXAMPLES = r''' - aci_tenant_span_src_group_to_dst_group: - host:"{{ inventory_hostname }}" - username:"{{ username }}" - password:"{{ password }}" - tenant:"{{ tenant }}" - src_group:"{{ src_group }}" - dst_group:"{{ dst_group }}" - description:"{{ description }}" + host: apic + username: admin + password: SomeSecretPassword + tenant: production + src_group: "{{ src_group }}" + dst_group: "{{ dst_group }}" + description: "{{ description }}" ''' RETURN = r''' diff --git a/test/integration/targets/aci_epg_to_contract/tasks/main.yml b/test/integration/targets/aci_epg_to_contract/tasks/main.yml index b47fbda1e6..58bbae6af8 100644 --- a/test/integration/targets/aci_epg_to_contract/tasks/main.yml +++ b/test/integration/targets/aci_epg_to_contract/tasks/main.yml @@ -176,7 +176,7 @@ state: absent register: provide_absent2 -- name: delte consume binding - idempotency works +- name: delete consume binding - idempotency works aci_epg_to_contract: <<: *aci_epg_consume_absent register: consume_absent_idempotent