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 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.

Hi Wei-Yen,

I tested just tested it out. It works.

Best regards

Rod