Access AAP Credentials in Playbook as vars

Posted on

Hello everyone,

I'm currently working on accessing credentials (username and password) that I've set up within the Red Hat Ansible Automation Platform (AAP) and using them as variables in my playbook.

Despite exploring the lookup module, I've encountered challenges getting it to function as expected. I've also attempted some methods commonly used in Ansible Tower, but they seem to be incompatible with the Red Hat AAP.

Here's a snippet of my current attempt with lookup:

# defaults/main.yml
username: '{{ lookup("credential", "Test Server", "username") }}'
password: '{{ lookup("credential", "Test Server", "password") }}'

Following this, my aim is to use the retrieved username and password as variables throughout the rest of the playbook.

Any insights or assistance you can provide would be appreciated.

Thank you!

Responses