mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 05:47:38 -02:30
Modifying credential for new get_one
This commit is contained in:
@@ -365,13 +365,14 @@ def main():
|
|||||||
|
|
||||||
# Attempt to look up the object based on the provided name, credential type and optional organization
|
# Attempt to look up the object based on the provided name, credential type and optional organization
|
||||||
lookup_data = {
|
lookup_data = {
|
||||||
'name': name,
|
|
||||||
'credential_type': cred_type_id,
|
'credential_type': cred_type_id,
|
||||||
}
|
}
|
||||||
if organization:
|
if organization:
|
||||||
lookup_data['organization'] = org_id
|
lookup_data['organization'] = org_id
|
||||||
|
|
||||||
credential = module.get_one('credentials', **{'data': lookup_data})
|
credential = module.get_one('credentials', name_or_id=name, **{'data': lookup_data})
|
||||||
|
# If we got an item back make sure the name field reflects the actual name (incase we were passed an ID)
|
||||||
|
name = credential['name'] if (credential) else name
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -82,9 +82,9 @@
|
|||||||
that:
|
that:
|
||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Re-create the Org-specific credential (new school)
|
- name: Re-create the Org-specific credential (new school) with an ID
|
||||||
tower_credential:
|
tower_credential:
|
||||||
name: "{{ ssh_cred_name1 }}"
|
name: "{{ result.id }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
credential_type: 'Machine'
|
credential_type: 'Machine'
|
||||||
state: present
|
state: present
|
||||||
|
|||||||
Reference in New Issue
Block a user