if one task fails on same node ansible does not execute any further task even they are working properly on it

93 views
Skip to first unread message

Sameer Modak

unread,
Aug 5, 2017, 1:30:12 PM8/5/17
to Ansible Project
Hello Team,



Below is the case where in first attempt when zypper code was on put first before all other tasks, It failed to excute register and copy task on [neslds12ainfo01],[NESLTR10AJAWA01] as previous zypper task failed it did not try to execute the valid task on it. Note: (Zypper task will fail as these two servers are redhat )

When I swapped the last two tasks before zypper task it worked as expected .

However, it should not have happened as the task which correctly should work as expected irrespective of 
earlier tasks fails or passes on same node.


Below is the Output before changing task order:-

[smodak@hel-shell-2 ~]$ ansible-playbook -K sample.yml
SSH password:
SUDO password[defaults to SSH password]:

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
fatal: [NESBWDA01]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to nesbwda01 closed.\r\n", "module_stdout": "Could not chdir to home directory /home/smodak: No such file or directory\r\n\r\nsmodak is not in the sudoers file.  This incident will be reported.\r\n", "msg": "MODULE FAILURE"}
ok: [NESGWDDB01]
ok: [NESEPDDB01]
ok: [NESGRDDB01]
ok: [NESHBDHDB01]
ok: [neslds12ainfo01]
ok: [NESLTR10AJAWA01]
ok: [NESHEDHDB01]
ok: [NESECDA01]
ok: [NESMIDDB01]
ok: [NESPIDDB01]
ok: [NESHMDHDB01]
ok: [NESNDIDB01]
ok: [NESMGDA01]
ok: [NESSMDDB01]
ok: [NESSTDDB01]

TASK [basic : Installing VIM] **************************************************
ok: [NESNDIDB01] => (item=[u'vim', u'ntp'])
ok: [NESHMDHDB01] => (item=[u'vim', u'ntp'])
ok: [NESMIDDB01] => (item=[u'vim', u'ntp'])
ok: [NESECDA01] => (item=[u'vim', u'ntp'])
failed: [NESLTR10AJAWA01] (item=[u'vim', u'ntp']) => {"cmd": "/usr/bin/zypper --quiet --non-interactive --xmlout search --type package --match-exact --details --installed-only ntp vim", "failed": true, "item": ["vim", "ntp"], "msg": "[Errno 2] No such file or directory", "rc": 2}
ok: [NESHEDHDB01] => (item=[u'vim', u'ntp'])
failed: [neslds12ainfo01] (item=[u'vim', u'ntp']) => {"cmd": "/usr/bin/zypper --quiet --non-interactive --xmlout search --type package --match-exact --details --installed-only ntp vim", "failed": true, "item": ["vim", "ntp"], "msg": "[Errno 2] No such file or directory", "rc": 2}
ok: [NESEPDDB01] => (item=[u'vim', u'ntp'])
ok: [NESGRDDB01] => (item=[u'vim', u'ntp'])
ok: [NESGWDDB01] => (item=[u'vim', u'ntp'])
ok: [NESPIDDB01] => (item=[u'vim', u'ntp'])
ok: [NESMGDA01] => (item=[u'vim', u'ntp'])
ok: [NESSMDDB01] => (item=[u'vim', u'ntp'])
ok: [NESSTDDB01] => (item=[u'vim', u'ntp'])
ok: [NESHBDHDB01] => (item=[u'vim', u'ntp'])

TASK [basic : return motd to registered var] ***********************************
changed: [NESGWDDB01]
changed: [NESHBDHDB01]
changed: [NESECDA01]
changed: [NESGRDDB01]
changed: [NESEPDDB01]
changed: [NESHEDHDB01]
changed: [NESMIDDB01]
changed: [NESNDIDB01]
changed: [NESMGDA01]
changed: [NESPIDDB01]
changed: [NESHMDHDB01]
changed: [NESSMDDB01]
changed: [NESSTDDB01]

TASK [basic : copying file in temp] ********************************************
ok: [NESGWDDB01]
ok: [NESECDA01]
ok: [NESGRDDB01]
ok: [NESEPDDB01]
ok: [NESHEDHDB01]
ok: [NESNDIDB01]
ok: [NESMIDDB01]
ok: [NESHBDHDB01]
ok: [NESPIDDB01]
ok: [NESMGDA01]
ok: [NESHMDHDB01]
ok: [NESSMDDB01]
ok: [NESSTDDB01]

===============================================================================

_______________________>

Below is the output after swapping task:



[smodak@hel-shell-2 ~]$ ansible-playbook -K sample.yml
SSH password:
SUDO password[defaults to SSH password]:

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
fatal: [NESBWDA01]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to nesbwda01 closed.\r\n", "module_stdout": "Could not chdir to home directory /home/smodak: No such file or directory\r\n\r\nsmodak is not in the sudoers file.  This incident will be reported.\r\n", "msg": "MODULE FAILURE"}
ok: [NESECDA01]
ok: [NESHBDHDB01]
ok: [NESGWDDB01]
ok: [NESEPDDB01]
ok: [NESHEDHDB01]
ok: [NESGRDDB01]
ok: [neslds12ainfo01]
ok: [NESHMDHDB01]
ok: [NESLTR10AJAWA01]
ok: [NESMIDDB01]
ok: [NESMGDA01]
ok: [NESPIDDB01]
ok: [NESNDIDB01]
ok: [NESSMDDB01]
ok: [NESSTDDB01]

TASK [basic : copying file in temp] ********************************************
ok: [NESGWDDB01]
ok: [NESHBDHDB01]
ok: [NESECDA01]
ok: [NESGRDDB01]
ok: [NESEPDDB01]
ok: [NESHEDHDB01]
changed: [NESLTR10AJAWA01]
changed: [neslds12ainfo01]
ok: [NESHMDHDB01]
ok: [NESMGDA01]
ok: [NESNDIDB01]
ok: [NESPIDDB01]
ok: [NESSMDDB01]
ok: [NESSTDDB01]
ok: [NESMIDDB01]

TASK [basic : Installing VIM] **************************************************
ok: [NESHMDHDB01] => (item=[u'vim', u'ntp'])
ok: [NESPIDDB01] => (item=[u'vim', u'ntp'])
failed: [NESLTR10AJAWA01] (item=[u'vim', u'ntp']) => {"cmd": "/usr/bin/zypper --quiet --non-interactive --xmlout search --type package --match-exact --details --installed-only ntp vim", "failed": true, "item": ["vim", "ntp"], "msg": "[Errno 2] No such file or directory", "rc": 2}
ok: [NESHEDHDB01] => (item=[u'vim', u'ntp'])
failed: [neslds12ainfo01] (item=[u'vim', u'ntp']) => {"cmd": "/usr/bin/zypper --quiet --non-interactive --xmlout search --type package --match-exact --details --installed-only ntp vim", "failed": true, "item": ["vim", "ntp"], "msg": "[Errno 2] No such file or directory", "rc": 2}
ok: [NESHBDHDB01] => (item=[u'vim', u'ntp'])
ok: [NESEPDDB01] => (item=[u'vim', u'ntp'])
ok: [NESECDA01] => (item=[u'vim', u'ntp'])
ok: [NESGRDDB01] => (item=[u'vim', u'ntp'])
ok: [NESGWDDB01] => (item=[u'vim', u'ntp'])
ok: [NESNDIDB01] => (item=[u'vim', u'ntp'])
ok: [NESMGDA01] => (item=[u'vim', u'ntp'])
ok: [NESMIDDB01] => (item=[u'vim', u'ntp'])
ok: [NESSMDDB01] => (item=[u'vim', u'ntp'])
ok: [NESSTDDB01] => (item=[u'vim', u'ntp'])

Sameer Modak

unread,
Aug 9, 2017, 1:20:02 PM8/9/17
to Ansible Project
Hello Guyz,

I have got the answer its ignore_errors which does the work.
Reply all
Reply to author
Forward
0 new messages