How to pass tower credential to create profile on any host

Posted on

How do I access credential parameters stored in Ansible Tower within a playbook? (For example: username, password, etc)
How do I use these variables(username/password) in any host to create profile.

I tried using below commands to get 'Machine' type credential but didn't worked.

 username: '{{ ansible_user }}'

password: '{{ ansible_password }}'

  username: '{{ lookup("env", "USERNAME") }}'
  password: '{{ lookup("env", "PASSWORD") }}'

Responses