How do I read/ use Ansible tower credentials (machine/ network/ Vault/ Source Control)?

24 views
Skip to first unread message

Saravanan

unread,
Jan 27, 2019, 9:07:24 PM1/27/19
to Ansible Project
Hi Ansible Experts,
This question is more relevant to Ansible Tower.
Can someone help to read the Ansible tower credentials in Playbook? 
We have created machine type credential called sampleCredential and password for it. Now how do I use them in the playbook

---
- hosts: all

  vars:
    machine:
      username: '{{ sampleCredential }}'
      password: '{{ sampleCredential }}'

  tasks:
    - debug:
        var: machine

Using this playbook, unable to retrieve the machine credential value in the playbook. Any help on this request much appreciated. 

Regards
Saravanan

  

Ankit Vashistha

unread,
Jan 28, 2019, 1:16:14 AM1/28/19
to ansible...@googlegroups.com
The question should be posted in AWX group or instead should be posted for your Red-hat support.

Coming to your question, you don't need to specifically define the username and password in the playbook. When you create a template, you choose the playbook, credentials (already created ones under credentials section of Ansible Tower) and other attributes for that particular template. Not sure what you are trying to achieve by trying to print the credentials though. 

Thanks and Regards,
Ankit Kumar Sharma

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1f25d6d0-bab6-419c-a8c9-b571969e54f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Saravanan Ponnusamy

unread,
Feb 5, 2019, 7:29:10 AM2/5/19
to ansible...@googlegroups.com
Hi Ankit,
Thanks for your reply. My question is whether can we use Ansible tower credentials in the playbook or not? I have experienced in using the tower credentials in the job template.
Is there anyway to use the credentials inside playbook to store the username/ password as part of the play execution?
Regards
Saravanan

Reply all
Reply to author
Forward
0 new messages