connection=local skips all remaining plays although only one host failed

20 views
Skip to first unread message

Jesse Schlüter

unread,
Jan 27, 2016, 7:53:39 AM1/27/16
to Ansible Project
Hello everyone,

I have a small problem and I am not sure whether this is a bug or "works as defined". We have a few Junos devices we are configuring and they require ansible_connection=local, but since 2.0 if one of the hosts/inventory items fails, he does not simply skip this one host, but all. Here is a simple sample to simulate this behaviour without the need for a Junos host:

Inventory (where 10.118.194.22 is down):
[junos]
10.118.194.11 ansible_connection=local
10.118.194.12 ansible_connection=local
10.118.194.21 ansible_connection=local
10.118.194.22 ansible_connection=local

Playbook (as port use something that is reachable ;) ):
---
- name: play1
  hosts: junos
  gather_facts: no
  tasks:
    - name: task1
      wait_for: host={{ inventory_hostname }} port=22 timeout=5
    - name: task2
      wait_for: host={{ inventory_hostname }} port=22 timeout=5

- name: play2
  hosts: junos
  gather_facts: no
  tasks:
    - name: task3
      wait_for: host={{ inventory_hostname }} port=22 timeout=5

What I would expect:
  1. starting play1
  2. running task1, failing on 10.118.194.22
  3. running task2 only for the non-failed hosts
  4. starting play2
  5. running task3 only for the non-failed hosts
What actually happens, is that he is not even starting play2. I suspect that the connection=local makes ansible behave like all four hosts are actually only one hosts. And since this one host failed skip it in all other plays. If you remove ansible_connection=local from each host (assuming they are ssh-able) it works as expected.

Is this a bug? Should I put this in Ansible Development?

Best regards,
Jesse
Reply all
Reply to author
Forward
0 new messages