The task is to install a package in 3 different appservers.
I am always getting
ansible-playbook: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n", "unreachable": true}
Oh, BTW why are you trying to complete this task using Ansible ? If you want to use Ansible then you need to make sure Ansible do have password less SSH access to all apps from jump host (if you are running Ansible from jump host). Or you need to define credentials inside inventory.
@Inderpreet, yes I generated the ssh key.I didn’t upload ssh key to other server. How can I do that via Ansible? I think ansible automatically manage this.
Hi I have done all that i.e generating ssh key on the ansible host and copied it into app servers. But ping does not work. Please see below screenshot.
@faisalbasha1982 It is telling, you have syntax problem in the file. Check your /etc/ansible/hosts file.
What I did is that, I created ansible.cfg file where I mention some configuration like where is my host/inventory file located etc. By doing this, I don’t touch the ansible default configuration file.
Thanks bro, but in this all I had to do inroder to test was this command:
ansible /home/thor/ansible/inventory -m ping stapp01
as the inventory files already had the servers. We just have to give the inventory path name in the command. I have successfully completed this task.
@faisalbasha1982 not really man. If you define path of inventory file in ansible.cfg file then you don’t need to give it. Ansible automatically finds that .