Hi All,
I am looking to fetch credentials stored in AWX/AAP with API.
The reason behind this is, we cant use 2 credentials of same type.
To overcome this problem, I was thinking if I could use some lookup in the ansible code.
I was told that is not possible (still open for suggestions here).
Then the alternative I thought was to use API to retrieve credentials.
API shows the username but for password it shows encrypted. Like this.
“inputs”: {
“userName”: “admin”,
“storageSystems”: “92,168,0,1”,
“userPassword”: “$encrypted$”
Is there any way to get unencrypted password to use in the playbook.
Thanks in anticipation.
Warm Regards.
Abhi
Hi Abhi,
there seem to be two main ways to deal with this situation:
-
Since it’s permitted to add multiple credentials to a job template as long as they are of different types, you can simply create a credential type and credential (of the corresponding type) for each credential (username/password/ssh key combination). Some logic may be required to look up credentials based on the hostname or whatever.
-
Another way is to split your inventory so that you run a separate job for each credential, having just the inventory that the credential can be used for. This probably requires an initial job template to split your overall inventory for the job and create the new jobs for each grouping of systems that use a particular credential.
I think the 2nd approach will be much more robust and secure.
yeah it is not possible to retrieve encrypted passwords via the API
what problem are you trying to solve, we may have a better practice for you
AWX Team