Reputation: 159
I am a beginner in Ansible.
I have one server - app.example.com in which I have installed Ansible.
I have 2 Client machines - Web1.example.com and Web2.example.com.
My question is how I will know from the Client machine that the Ansible server is app.example.com
Like from the Ansible server I can find out all Client's machines in /etc/Ansible/hosts
Upvotes: 0
Views: 301
Reputation: 6168
Assuming you know the name of the service account (such as ansible
) that Ansible uses on the client, and that Ansible has logged in at some time, look in /var/log/secure
. You should see an entry like this:
Aug 25 09:29:02 Client1 sshd[1343]: Accepted publickey for ansible from 192.168.124.8 port 59036 ssh2: RSA SHA256:FL2me6GmqX6SAx5CI0hJ/ZXXStnmrCdCtBbfBlk5N5E
We see is logged in from 192.168.124.8
.
Now...
$ getent hosts 192.168.124.8
192.168.124.8 AnsibleTower
So the hostname of the Ansible Controller is AnsibleTower
.
Upvotes: 1