Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 combination of any_errors_fatal, ignore_errors, and when statement skips tasks #15431

Closed
drfickle opened this issue Apr 15, 2016 · 3 comments
Assignees
Labels
bug This issue/PR relates to a bug.
Milestone

Comments

@drfickle
Copy link
Contributor

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible 2.0.2.0
  config file = /home/sfox/.ansible.cfg
  configured module search path = /home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/library

(specifically 2.0.2.0-rc4)

CONFIGURATION
library = /home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/library
forks          = 20
sudo_flags = -H -i
jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n,jinja2.ext.loopcontrols,jinja2.ext.with_
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
action_plugins     = /usr/share/ansible_plugins/action_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/action
callback_plugins   = /usr/share/ansible_plugins/callback_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/callback
connection_plugins = /usr/share/ansible_plugins/connection_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/connection
lookup_plugins     = /usr/share/ansible_plugins/lookup_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/lookup
vars_plugins       = /usr/share/ansible_plugins/vars_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/vars
filter_plugins     = /usr/share/ansible_plugins/filter_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/filter
nocows = 1
OS / ENVIRONMENT

From: Fedora 23
Managing: Ubuntu Trusty (14.04)

SUMMARY

When a playbook specifies any_errors_fatal and a task that only runs for certain hosts includes a ignore_errors statement, the skipped host doesn't run any tasks after the one with the ignore_errors statement.

STEPS TO REPRODUCE

Using this inventory file

[sd-zt-steve.training]
sd-zt-steve-training-0 ansible_ssh_host=10.0.0.84 version=11.0
sd-zt-steve-training-1 ansible_ssh_host=10.0.0.85 version=11.1

and this playbook

- name: TEST
  hosts: sd-zt-steve.training
  remote_user: root
  any_errors_fatal: true

  tasks:  
    - debug: var=version

    - name: Kill all ejabberd related processes
      shell: killall beam ejabberd epmd
      ignore_errors: yes                                 
      when: version|version_compare('11.0', '>')

    - debug: var=version

or this playbook

- name: TEST
  hosts: sd-zt-steve.training
  remote_user: root
  any_errors_fatal: true

  tasks:  
    - debug: var=version

    - include: pants.yml                                           
      when: version|version_compare('11.0', '>')

    - debug: var=version

with this included task

- name: Kill all ejabberd related processes
  shell: killall beam ejabberd epmd
  ignore_errors: yes

the host sd-zt-steve-training-0 stops executing tasks. This is a very simplified excerpt from a much larger playbook which show the same behavior and skips lots of tasks. Removing either the any_errors_fatal or the when statement causes it to behave as expected.

EXPECTED RESULTS
PLAY [TEST] ********************************************************************

TASK [setup] *******************************************************************
ok: [sd-zt-steve-training-1]
ok: [sd-zt-steve-training-0]

TASK [debug] *******************************************************************
ok: [sd-zt-steve-training-0] => {
    "version": 11.0
}
ok: [sd-zt-steve-training-1] => {
    "version": 11.1
}

TASK [Kill all ejabberd related processes] *************************************
skipping: [sd-zt-steve-training-0]
fatal: [sd-zt-steve-training-1]: FAILED! => {"changed": true, "cmd": "killall beam ejabberd epmd", "delta": "0:00:00.007732", "end": "2016-04-15 08:08:40.850848", "failed": true, "rc": 1, "start": "2016-04-15 08:08:40.843116", "stderr": "beam: no process found\nejabberd: no process found\nepmd: no process found", "stdout": "", "stdout_lines": [], "warnings": []}
...ignoring

TASK [debug] *******************************************************************
ok: [sd-zt-steve-training-0] => {
    "version": 11.0
}
ok: [sd-zt-steve-training-1] => {
    "version": 11.1
}

PLAY RECAP *********************************************************************
sd-zt-steve-training-0     : ok=3    changed=0    unreachable=0    failed=0   
sd-zt-steve-training-1     : ok=4    changed=0    unreachable=0    failed=0
ACTUAL RESULTS
PLAY [TEST] ********************************************************************

TASK [setup] *******************************************************************
ok: [sd-zt-steve-training-0]
ok: [sd-zt-steve-training-1]

TASK [debug] *******************************************************************
ok: [sd-zt-steve-training-0] => {
    "version": 11.0
}
ok: [sd-zt-steve-training-1] => {
    "version": 11.1
}

TASK [include] *****************************************************************
skipping: [sd-zt-steve-training-0]
included: /home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/playbooks/full_leds_setup/pants.yml for sd-zt-steve-training-1

TASK [Kill all ejabberd related processes] *************************************
fatal: [sd-zt-steve-training-1]: FAILED! => {"changed": true, "cmd": "killall beam ejabberd epmd", "delta": "0:00:00.008428", "end": "2016-04-15 08:34:09.937926", "failed": true, "rc": 1, "start": "2016-04-15 08:34:09.929498", "stderr": "beam: no process found\nejabberd: no process found\nepmd: no process found", "stdout": "", "stdout_lines": [], "warnings": []}
...ignoring

TASK [debug] *******************************************************************
ok: [sd-zt-steve-training-1] => {
    "version": 11.1
}

PLAY RECAP *********************************************************************
sd-zt-steve-training-0     : ok=2    changed=0    unreachable=0    failed=0   
sd-zt-steve-training-1     : ok=5    changed=0    unreachable=0    failed=0
@bcoca bcoca added this to the stable-2.0 milestone Apr 25, 2016
@jimi-c jimi-c self-assigned this Apr 25, 2016
@masteinhauser
Copy link

masteinhauser commented Apr 27, 2016

Confirming this bug report and the simplified examples trigger the same issue we have found in a larger playbook. This is a blocker for us (https://github.com/blueboxgroup/ursula) to upgrade to Ansible v2.

@jimi-c
Copy link
Member

jimi-c commented May 1, 2016

Closing This Ticket

Hi!

We believe the above commit should resolve this problem for you. This will also be included in the next release.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved.

Thank you!

@drfickle
Copy link
Contributor Author

drfickle commented May 3, 2016

Fix confirmed. Thank you!

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

5 participants