mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 10:27:37 -02:30
Updating user module for new get_one
This commit is contained in:
@@ -134,11 +134,9 @@ def main():
|
|||||||
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
||||||
|
|
||||||
# Attempt to look up an existing item based on the provided data
|
# Attempt to look up an existing item based on the provided data
|
||||||
existing_item = module.get_one('users', **{
|
existing_item = module.get_one('users', name_or_id=username)
|
||||||
'data': {
|
# If we got an item back make sure the name field reflects the actual name (incase we were passed an ID)
|
||||||
'username': username,
|
username = existing_item['username'] if (existing_item) else username
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
|
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
that:
|
that:
|
||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Change a User
|
- name: Change a User by ID
|
||||||
tower_user:
|
tower_user:
|
||||||
username: "{{ username }}"
|
username: "{{ result.id }}"
|
||||||
last_name: User
|
last_name: User
|
||||||
email: joe@example.org
|
email: joe@example.org
|
||||||
state: present
|
state: present
|
||||||
|
|||||||
Reference in New Issue
Block a user