2

I am using AWX (open source Ansible Tower) and I have 2 cloud based linux machines I would like to manage with it.

The 2 Linux machines have 2 different private keys that I have uploaded to the credentials section of AWX UI.

Now I would like to use those uploaded private keys in a playbook or as a variable in one of the inventory files.

How can I do that?

(I saw a redhat article https://access.redhat.com/solutions/3332591 that might be useful, but it is locked unless I have an active RH subscription )

binithb
  • 173

1 Answers1

1

Apparently it could be done by using a hosts( or an inventory file with another name) from version control and importing that file using the "SOURCES" option of "inventories" tab in AWX.

Following is an example of this "hosts" file in version control

[jenkins_slaves]
slave1IP
slave2IP

[jenkins_master]
masterIP

[aws]
aws1IP
aws2IP

[all:vars]
ansible_user=common_user
ansible_ssh_private_key_file=/home/awx/.ssh/common_key.pem


[jenkins_slaves:vars]
ansible_user=james
ansible_ssh_private_key_file=/home/awx/.ssh/slaves_key.pem

[jenkins_master:vars]
ansible_user=bond
ansible_ssh_private_key_file=/home/awx/.ssh/master_key.pem

[aws:vars]
ansible_user=ubuntu

And ofcourse "common_key.pem" should not be kept in version control. It should be manually added to some local path on the AWX server

binithb
  • 173