Different access credentials for devices using network_cli

11 views
Skip to first unread message

Rod Oliver

unread,
May 6, 2020, 10:16:10 PM5/6/20
to AWX Project
It is possible to assign more than one credential to a job template, however there can be only one credential of any given type. According to https://docs.ansible.com/ansible-tower/latest/html/userguide/credentials.html#machine, the credential type designated for network devices that use network_cli should be "machine" which means that all network devices in the inventory that is used in a given job_template must be accessible using a single machine credential. I'm looking for a solution (in AWX) to enable that devices, that have different username/password pairs, to be part of the same inventory, which seems to preclude using a machine credential. Would creating a custom credential which creates environment variables for each username and password value and then setting the ansible_user and ansible_password for particular hosts or groups from a lookup be a good solution? 

Rod Oliver

Wei-Yen Tan

unread,
May 6, 2020, 10:22:19 PM5/6/20
to Rod Oliver, AWX Project
You could use custom credentials type and supply vars on that one play from the custom credential type.  So on that one play put in some vars for the connection and create a custom credential with the extra-vars you specified.

It may not sound clear now but can supply details later. Just thought I would let you know I believe it is possible. Will do some testing as I have some thing like this to as well.  


From: awx-p...@googlegroups.com <awx-p...@googlegroups.com> on behalf of Rod Oliver <rodo...@gmail.com>
Sent: Thursday, May 7, 2020 2:16:10 PM
To: AWX Project <awx-p...@googlegroups.com>
Subject: [awx-project] Different access credentials for devices using network_cli
 
It is possible to assign more than one credential to a job template, however there can be only one credential of any given type. According to https://docs.ansible.com/ansible-tower/latest/html/userguide/credentials.html#machine, the credential type designated for network devices that use network_cli should be "machine" which means that all network devices in the inventory that is used in a given job_template must be accessible using a single machine credential. I'm looking for a solution (in AWX) to enable that devices, that have different username/password pairs, to be part of the same inventory, which seems to preclude using a machine credential. Would creating a custom credential which creates environment variables for each username and password value and then setting the ansible_user and ansible_password for particular hosts or groups from a lookup be a good solution? 

Rod Oliver

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/1cea1d8f-1c4d-49c8-9e54-ca52f72e53be%40googlegroups.com.

Rod Oliver

unread,
May 7, 2020, 3:49:16 AM5/7/20
to Wei-Yen Tan, AWX Project
Hi Wei-Yen,

I tested just tested it out. It works.

Best regards

Rod
Reply all
Reply to author
Forward
0 new messages