Modifying credential for new get_one

This commit is contained in:
John Westcott IV 2020-09-03 11:17:21 -04:00
parent 5042ad3a2b
commit 24ec129235
2 changed files with 5 additions and 4 deletions

View File

@ -365,13 +365,14 @@ def main():
# Attempt to look up the object based on the provided name, credential type and optional organization
lookup_data = {
'name': name,
'credential_type': cred_type_id,
}
if organization:
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 the state was absent we can let the module delete it if needed, the module will handle exiting from this

View File

@ -82,9 +82,9 @@
that:
- "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:
name: "{{ ssh_cred_name1 }}"
name: "{{ result.id }}"
organization: Default
credential_type: 'Machine'
state: present