aci_aaa_user_certificate: Rename user parameter to aaa_user (#35207)
This commit is contained in:
parent
f94fe61b6b
commit
64df1a7566
2 changed files with 25 additions and 25 deletions
|
@ -23,12 +23,17 @@ author:
|
||||||
- Dag Wieers (@dagwieers)
|
- Dag Wieers (@dagwieers)
|
||||||
version_added: '2.5'
|
version_added: '2.5'
|
||||||
notes:
|
notes:
|
||||||
- The C(user) must exist before using this module in your playbook.
|
- The C(aaa_user) must exist before using this module in your playbook.
|
||||||
The M(aci_user) module can be used for this.
|
The M(aci_aaa_user) module can be used for this.
|
||||||
options:
|
options:
|
||||||
user:
|
aaa_user:
|
||||||
description:
|
description:
|
||||||
- The name of the user to add a certificate to.
|
- The name of the user to add a certificate to.
|
||||||
|
aaa_user_type:
|
||||||
|
description:
|
||||||
|
- Whether this is a normal user or an appuser.
|
||||||
|
choices: [ user, userapp ]
|
||||||
|
default: user
|
||||||
certificate:
|
certificate:
|
||||||
description:
|
description:
|
||||||
- The PEM format public key extracted from the X.509 certificate.
|
- The PEM format public key extracted from the X.509 certificate.
|
||||||
|
@ -37,11 +42,6 @@ options:
|
||||||
description:
|
description:
|
||||||
- The name of the user certificate entry in ACI.
|
- The name of the user certificate entry in ACI.
|
||||||
aliases: [ cert_name ]
|
aliases: [ cert_name ]
|
||||||
user_type:
|
|
||||||
description:
|
|
||||||
- Whether this is a normal user or an appuser.
|
|
||||||
choices: [ user, userapp ]
|
|
||||||
default: user
|
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Use C(present) or C(absent) for adding or removing.
|
- Use C(present) or C(absent) for adding or removing.
|
||||||
|
@ -57,7 +57,7 @@ EXAMPLES = r'''
|
||||||
host: apic
|
host: apic
|
||||||
username: admin
|
username: admin
|
||||||
password: SomeSecretPassword
|
password: SomeSecretPassword
|
||||||
user: admin
|
aaa_user: admin
|
||||||
certificate_name: admin
|
certificate_name: admin
|
||||||
certificate_data: '{{ lookup("file", "pki/admin.crt") }}'
|
certificate_data: '{{ lookup("file", "pki/admin.crt") }}'
|
||||||
state: present
|
state: present
|
||||||
|
@ -67,7 +67,7 @@ EXAMPLES = r'''
|
||||||
host: apic
|
host: apic
|
||||||
username: admin
|
username: admin
|
||||||
password: SomeSecretPassword
|
password: SomeSecretPassword
|
||||||
user: admin
|
aaa_user: admin
|
||||||
certificate_name: admin
|
certificate_name: admin
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ EXAMPLES = r'''
|
||||||
host: apic
|
host: apic
|
||||||
username: admin
|
username: admin
|
||||||
password: SomeSecretPassword
|
password: SomeSecretPassword
|
||||||
user: admin
|
aaa_user: admin
|
||||||
certificate_name: admin
|
certificate_name: admin
|
||||||
state: query
|
state: query
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ EXAMPLES = r'''
|
||||||
host: apic
|
host: apic
|
||||||
username: admin
|
username: admin
|
||||||
password: SomeSecretPassword
|
password: SomeSecretPassword
|
||||||
user: admin
|
aaa_user: admin
|
||||||
state: query
|
state: query
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -109,35 +109,35 @@ ACI_MAPPING = dict(
|
||||||
def main():
|
def main():
|
||||||
argument_spec = aci_argument_spec()
|
argument_spec = aci_argument_spec()
|
||||||
argument_spec.update(
|
argument_spec.update(
|
||||||
|
aaa_user=dict(type='str', required=True),
|
||||||
|
aaa_user_type=dict(type='str', default='user', choices=['appuser', 'user']),
|
||||||
certificate=dict(type='str', aliases=['cert_data', 'certificate_data']),
|
certificate=dict(type='str', aliases=['cert_data', 'certificate_data']),
|
||||||
certificate_name=dict(type='str', aliases=['cert_name']),
|
certificate_name=dict(type='str', aliases=['cert_name']),
|
||||||
state=dict(type='str', default='present', choices=['absent', 'present', 'query']),
|
state=dict(type='str', default='present', choices=['absent', 'present', 'query']),
|
||||||
user=dict(type='str', required=True),
|
|
||||||
user_type=dict(type='str', default='user', choices=['appuser', 'user']),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
required_if=[
|
required_if=[
|
||||||
['state', 'absent', ['user', 'certificate_name']],
|
['state', 'absent', ['aaa_user', 'certificate_name']],
|
||||||
['state', 'present', ['user', 'certificate', 'certificate_name']],
|
['state', 'present', ['aaa_user', 'certificate', 'certificate_name']],
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
aaa_user = module.params['aaa_user']
|
||||||
|
aaa_user_type = module.params['aaa_user_type']
|
||||||
certificate = module.params['certificate']
|
certificate = module.params['certificate']
|
||||||
certificate_name = module.params['certificate_name']
|
certificate_name = module.params['certificate_name']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
user = module.params['user']
|
|
||||||
user_type = module.params['user_type']
|
|
||||||
|
|
||||||
aci = ACIModule(module)
|
aci = ACIModule(module)
|
||||||
aci.construct_url(
|
aci.construct_url(
|
||||||
root_class=dict(
|
root_class=dict(
|
||||||
aci_class=ACI_MAPPING[user_type]['aci_class'],
|
aci_class=ACI_MAPPING[aaa_user_type]['aci_class'],
|
||||||
aci_rn=ACI_MAPPING[user_type]['aci_mo'] + user,
|
aci_rn=ACI_MAPPING[aaa_user_type]['aci_mo'] + aaa_user,
|
||||||
filter_target='eq({0}.name, "{1}")'.format(ACI_MAPPING[user_type]['aci_class'], user),
|
filter_target='eq({0}.name, "{1}")'.format(ACI_MAPPING[aaa_user_type]['aci_class'], aaa_user),
|
||||||
module_object=user,
|
module_object=aaa_user,
|
||||||
),
|
),
|
||||||
subclass_1=dict(
|
subclass_1=dict(
|
||||||
aci_class='aaaUserCert',
|
aci_class='aaaUserCert',
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||||
user: admin
|
aaa_user: admin
|
||||||
certificate_name: admin
|
certificate_name: admin
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||||
user: admin
|
aaa_user: admin
|
||||||
certificate_name: admin
|
certificate_name: admin
|
||||||
certificate: "{{ lookup('file', 'pki/admin.crt') }}"
|
certificate: "{{ lookup('file', 'pki/admin.crt') }}"
|
||||||
state: present
|
state: present
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||||
user: admin
|
aaa_user: admin
|
||||||
state: query
|
state: query
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: cm_query_all_certs
|
register: cm_query_all_certs
|
||||||
|
|
Loading…
Reference in a new issue