7from __future__
import absolute_import, division, print_function
10ANSIBLE_METADATA = {
'metadata_version':
'1.1',
11 'status': [
'preview'],
12 'supported_by':
'certified'}
16module: aci_taboo_contract
17short_description: Manage taboo contracts (vz:BrCP)
19- Manage taboo contracts on Cisco ACI fabrics.
24 - The name of the Taboo Contract.
30 - The description for the Taboo Contract.
35 - The name of the tenant.
38 aliases: [ tenant_name ]
41 - The scope of a service contract.
42 - The APIC defaults to C(context) when unset during creation.
44 choices: [ application-profile, context,
global, tenant ]
47 - Use C(present)
or C(absent)
for adding
or removing.
48 - Use C(query)
for listing an object
or multiple objects.
50 choices: [ absent, present, query ]
52extends_documentation_fragment: aci
54- The C(tenant) used must exist before using this module
in your playbook.
55 The M(aci_tenant) module can be used
for this.
58- name: APIC Management Information Model reference
59 description: More information about the internal APIC
class B(vz:BrCP).
60 link: https://developer.cisco.com/docs/apic-mim-ref/
62- Dag Wieers (
@dagwieers)
66- name: Add taboo contract
70 password: SomeSecretPassword
72 taboo_contract: taboo_contract_test
74 delegate_to: localhost
76- name: Remove taboo contract
80 password: SomeSecretPassword
82 taboo_contract: taboo_contract_test
84 delegate_to: localhost
86- name: Query all taboo contracts
90 password: SomeSecretPassword
92 delegate_to: localhost
93 register: query_result
95- name: Query a specific taboo contract
99 password: SomeSecretPassword
101 taboo_contract: taboo_contract_test
103 delegate_to: localhost
104 register: query_result
109 description: The existing configuration from the APIC after the module has finished
117 "descr":
"Production environment",
118 "dn":
"uni/tn-production",
119 "name":
"production",
128 description: The error information
as returned
from the APIC
134 "text":
"unknown managed object class foo"
137 description: The raw output returned by the APIC REST API (xml
or json)
138 returned: parse error
140 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
142 description: The actual/minimal configuration pushed to the APIC
149 "descr":
"Production environment"
154 description: The original configuration
from the APIC before the module has started
162 "descr":
"Production",
163 "dn":
"uni/tn-production",
164 "name":
"production",
173 description: The assembled configuration
from the user-provided parameters
180 "descr":
"Production environment",
186 description: The filter string used
for the request
187 returned: failure
or debug
189 sample: ?rsp-prop-include=config-only
191 description: The HTTP method used
for the request to the APIC
192 returned: failure
or debug
196 description: The HTTP response
from the APIC
197 returned: failure
or debug
199 sample: OK (30 bytes)
201 description: The HTTP status
from the APIC
202 returned: failure
or debug
206 description: The HTTP url used
for the request to the APIC
207 returned: failure
or debug
209 sample: https://10.11.12.13/api/mo/uni/tn-production.json
212from ansible.module_utils.basic import AnsibleModule
213from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
218 argument_spec.update(
219 taboo_contract=dict(type='str', aliases=[
'name']),
220 tenant=dict(type=
'str', aliases=[
'tenant_name']),
221 scope=dict(type=
'str', choices=[
'application-profile',
'context',
'global',
'tenant']),
222 description=dict(type=
'str', aliases=[
'descr']),
223 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
227 argument_spec=argument_spec,
228 supports_check_mode=
True,
230 [
'state',
'absent', [
'tenant',
'taboo_contract']],
231 [
'state',
'present', [
'tenant',
'taboo_contract']],
235 taboo_contract = module.params[
'taboo_contract']
236 description = module.params[
'description']
237 scope = module.params[
'scope']
238 state = module.params[
'state']
239 tenant = module.params[
'tenant']
244 aci_class=
'fvTenant',
245 aci_rn=
'tn-{0}'.
format(tenant),
246 module_object=tenant,
247 target_filter={
'name': tenant},
251 aci_rn=
'taboo-{0}'.
format(taboo_contract),
252 module_object=taboo_contract,
253 target_filter={
'name': taboo_contract},
259 if state ==
'present':
269 aci.get_diff(aci_class=
'vzTaboo')
273 elif state ==
'absent':
279if __name__ ==
"__main__":