Conditional skipped?

12 views
Skip to first unread message

John Oliver

unread,
Dec 12, 2016, 2:50:17 PM12/12/16
to Ansible Project
My little playbook:

- hosts: all
  become: true
  become_user: root
  become_method: sudo

  tasks:

  - name: Update McAfee virus definitions
    shell: /opt/McAfee/LinuxShield/bin/nails task --run 1
    register: result

  - name: Update McAfee virus definitions 2
    shell: /opt/NAI/LinuxShield/bin/nails task --run 1
    when: result|failed


I did this because one of my hosts doesn't have nails installed where the rest do.  Why?  Dunno.  But when I run this, all of the hosts that have the first command run successfully are skipped, as I expected, but the one isn't mentioned at all, other than the failure in the first case.  That one host was completely skipped for the second command.  Any ideas why?

Kai Stian Olstad

unread,
Dec 13, 2016, 1:14:27 AM12/13/16
to ansible...@googlegroups.com
When the a task fails for a host, Ansible will stop the play for that
host and no subsequent task will be executed if ignore_errors is not set
to true.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages