mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 10:40:22 -07:00
tower_user: Fix to create a system auditor properly (#54585)
- Fixed issue #54446: tower_user cannot create an auditor user Signed-off-by: Hideki Saito <saito@fgrep.org>
This commit is contained in:
parent
7eae4761b8
commit
d86183f595
2 changed files with 32 additions and 1 deletions
2
changelogs/fragments/tower_user-system-auditor.yaml
Normal file
2
changelogs/fragments/tower_user-system-auditor.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- tower_user - Fix to create user as a system auditor when specifying the `auditor` option (https://github.com/ansible/ansible/issues/54446)
|
|
@ -55,6 +55,10 @@ options:
|
||||||
- Desired state of the resource.
|
- Desired state of the resource.
|
||||||
default: "present"
|
default: "present"
|
||||||
choices: ["present", "absent"]
|
choices: ["present", "absent"]
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
- ansible-tower-cli >= 3.2.0
|
||||||
|
|
||||||
extends_documentation_fragment: tower
|
extends_documentation_fragment: tower
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -69,6 +73,31 @@ EXAMPLES = '''
|
||||||
last_name: Doe
|
last_name: Doe
|
||||||
state: present
|
state: present
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
|
- name: Add tower user as a system administrator
|
||||||
|
tower_user:
|
||||||
|
username: jdoe
|
||||||
|
password: foobarbaz
|
||||||
|
email: jdoe@example.org
|
||||||
|
superuser: yes
|
||||||
|
state: present
|
||||||
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
|
- name: Add tower user as a system auditor
|
||||||
|
tower_user:
|
||||||
|
username: jdoe
|
||||||
|
password: foobarbaz
|
||||||
|
email: jdoe@example.org
|
||||||
|
auditor: yes
|
||||||
|
state: present
|
||||||
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
|
- name: Delete tower user
|
||||||
|
tower_user:
|
||||||
|
username: jdoe
|
||||||
|
email: jdoe@example.org
|
||||||
|
state: absent
|
||||||
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.ansible_tower import TowerModule, tower_auth_config, tower_check_mode
|
from ansible.module_utils.ansible_tower import TowerModule, tower_auth_config, tower_check_mode
|
||||||
|
@ -115,7 +144,7 @@ def main():
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
result = user.modify(username=username, first_name=first_name, last_name=last_name,
|
result = user.modify(username=username, first_name=first_name, last_name=last_name,
|
||||||
email=email, password=password, is_superuser=superuser,
|
email=email, password=password, is_superuser=superuser,
|
||||||
is_auditor=auditor, create_on_missing=True)
|
is_system_auditor=auditor, create_on_missing=True)
|
||||||
json_output['id'] = result['id']
|
json_output['id'] = result['id']
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
result = user.delete(username=username)
|
result = user.delete(username=username)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue