Welcome to the Linux Foundation Forum!

Help with YAML

I just started playing around with YAML two days ago and have ran into a problem I can't figure out. My set up is three VMs within VirtualBox. I'm using one VM as my YAML controller, and the other two as plain hosts/targets for my testing.

Here's what I'm working with. I have a playbook named myplay.yml that holds the following:

[osboxes@ansible controller test_project]$ cat myplay.yml

name: Test connectivity
hosts: all
tasks:
- name: Ping tests
ping:

Then a simple hosts file:

[osboxes@ansible controller test_project]$ cat myhosts
192.168.44.109
192.168.44.110

I run the following command and see this error message:

[osboxes@ansible controller test_project]$ ansible-playbook myplay.yml -i myhosts

PLAY [Test connectivity] ******************************************************************************************

TASK [Gathering Facts] ********************************************************************************************
fatal: [192.168.44.109]: 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}
fatal: [192.168.44.110]: 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}
to retry, use: --limit @/home/osboxes/test_project/myplay.retry

PLAY RECAP ********************************************************************************************************
192.168.44.109 : ok=0 changed=0 unreachable=1 failed=0
192.168.44.110 : ok=0 changed=0 unreachable=1 failed=0

I can ssh to both hosts from my VM acting as the controller (the VM where ansible is installed and where I'm running the commands from). What is bugging me is why is it trying to ssh to these hosts when all I'm doing is running a ping test?????

Any input is appreciated.

Thanks,

Andy

Comments

  • Apologies. I didn't realize this was a course-related forum. I did end up fixing it by using the following in the myhosts file:

    target1 ansible_host=192.168.44.109 ansible_user=osboxes ansible_ssh_pass=osboxes.org
    target2 ansible_host=192.168.44.110 ansible_user=osboxes ansible_ssh_pass=osboxes.org

    You can delete or move if you like.

    Thanks,

    Andy

Categories

Upcoming Training