I am looking for a help in the features available with the AWX V 24.0.0.
I have a Credential of “Private-key from file” “key1” which is used by template “Template1”.
I used to rotate the contents of key1 with an ansible playbook using awx.awx.credetial module .
To have a backup of key1 which is required for the execution of another template “Template2” , key2 is crearted before the ansible playbook is executed and contents of key1 is rotated (i.e a copy of key1 is made in key2 using copy_from of awx.awx.credetial before it is renewed)
The credential key2 is to be used by template “Template2” which is also working .
However the challenge is that ,
The Copy_from of awx.awx.credetial module does not update the contents if the key2 already exists.(No Override/Overwrite option ??)
Only a new key2 is created everytime.(have to configure/attach the credential key2 at the execution of “Template2”)
Is that possible to attach the credential “key2”[not manaully) to “Template2” using the curl/api during execution only ?
I mean the Credential “key2” needs to be part of “Template2” during execution, as the key2 will be created 5 minutes before the start of “Template2” execution.
OR
Is there a way to read the contents of Credential of “Private-key from file” “key1” and write to a file “mykey.pem” in the Execution-Environment?
This will help me to clear all my challenges . So that I can write the contents to the “key2” using api and URI module.
To answer the question, from what I know, AWX/AAP Controller will guard whatever key is stored and I’m pretty sure it’s a one-way street, you can only put secrets in and use them, but you cannot get them out.
That said, why don’t you flip it around? Instead of trying to manage existing keys in your AWX instance with Ansible, use Ansible to manage the available keys in your AWX instance.
This will also help you in case your AWX instance gets borked by whatever reason, or, like in my case, you need to deploy a new/second one with the same baseline configuration already present.