Unable to install packages through Ansible

0 votes
I'm trying to install packages using Ansible but I keep getting the following error from both master and worker node

fatal: [masternode]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).", "unreachable": true}

fatal: [workernode]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).", "unreachable": true}

I'm using the following playbook

- hosts: all
  user: ansible
  become: True
  tasks:
    - name: Insall git
      yum:
        name: git
        state: present
        update_cache: True

I'm able to ping the master VM from my worker node and I'm able to ping the worker node from my master VM, so I'm not sure what the issue is.

I'm using CentOS 7 and GCP instances. I have an ansible.cfg file setup

[defaults]
inventory           = hosts
host_key_checking   = False

I also have a hosts file setup

10.128.0.3 (master node IP)
10.128.0.4 (worker node IP)

I also have the default hosts file setup (/etc/ansible/hosts)

[gcpnodes]

masternode ansible_ssh_host=10.128.0.3
workernode ansible_ssh_host=10.128.0.4
Jul 15, 2020 in Ansible by Edureka
• 120 points
1,431 views

1 answer to this question.

0 votes

Hi,

Try to ping your all nodes. There may be a problem with connectivity, All the nodes should ping with there hostname. You can also use the below command to check.

$ ansible -m ping all
answered Jul 15, 2020 by MD
• 95,460 points

Related Questions In Ansible

0 votes
1 answer

Unable to install Ansible on centOS

Seems like you're stuck at creating ansible ...READ MORE

answered Dec 20, 2018 in Ansible by Alan
653 views
0 votes
1 answer
0 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,935 views
+2 votes
1 answer
0 votes
1 answer

I could install Git, can u please explain how to set up chromedriver(selenium), chromium browser(selenium) on the slave node through Ansible

Hi@Vinodkumar, Did you go through the related question ...READ MORE

answered Dec 22, 2020 in Ansible by MD
• 95,460 points
1,258 views
0 votes
1 answer

No match for argument: ansible Error: Unable to find a match

Hi@akhtar, Ansible is not part of your RedHat ...READ MORE

answered Jul 28, 2020 in Ansible by MD
• 95,460 points
14,900 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP