We currently have 3 boxes setup via Vagrant, with the following inventory file:
[loadbalancer]
node-1 ansible_host=192.168.50.10 ansible_user=ubuntu
[webservers]
node-2 ansible_host=192.168.50.11 ansible_user=ubuntu
[dbservers]
node-3 ansible_host=192.168.50.12 ansible_user=ubuntu
I'm following the github example for a rolling upgrade: https://github.com/ansible/ansible-examples/blob/master/lamp_haproxy/rolling_update.yml
My playbook looks like this:
pre_tasks:
- name: disable the server in haproxy
haproxy: 'state=disabled backend=myapplb host={{ inventory_hostname }} socket=/var/lib/haproxy/stats'
delegate_to: "{{ ansible_host }}"
with_items: groups.loadbalancer
The task fails with the below statement:
failed: [node-2] (item=groups.loadbalancer) => {"item": "groups.loadbalancer", "msg": "Failed to connect to the host via ssh: [email protected]: Permission denied (publickey).\r\n", "unreachable": true}
What is surprising is the line XXX@192.168.50.11. XXX does not match the ansible_user provided in the inventory file.
Could this be the cause of the error?