有人能告诉我为什么当第二个任务“Verifying PATCHBUNDLE”失败时下面的救援块没有执行吗?
---
- name: HDP Validation
hosts: HDP
serial: 1000
gather_facts: false
ignore_errors: true
tasks:
-name: PATCHBUNDLE Check
block:
- name: Current PATCHBUNDLE
shell: cat /iv/piv/a00/playbooks/PATCHING/current_patchbundle
delegate_to: 127.0.0.1
register: current_bundle
run_once: true
- name: Verifying PATCHBUNDLE - current bundle is set to {{ current_bundle.stdout }}
shell: "cat /etc/.jumpver | tail -2 | grep USEPATCHBUNDLE={{ current_bundle.stdout }}"
tags: patch
register: bundle
rescue:
- name: Grab PATCHBUNDLE and PATCHBUNDLE DATE
shell: "cat /etc/.jumpver | tail -2 | tr '\n' ' ' | sed 's/USEPATCHBUNDLE=/BUNDLE: /; s/USEPATCHBUNDLEAPPLIEDDATE=/APPLIED: /; s/ $//;'"
tags: patchdate
register: bundledate
- debug:
msg: "{{ bundledate.stdout }}"
always:
- name: rpm Kernel Check non-VMs
shell: rpm -qa --last | grep -.........
提供以下输出:
PLAY [HDP Validation] ********************************
TASK [Current PATCHBUNDLE] *************
changed: [eagnmnmep3268 -> 127.0.0.1]
TASK [Verifying PATCHBUNDLE - current bundle is set to 2023-04-R32] ********************************
fatal: [eagnmnmep3268]: FAILED! => {"changed": true, "cmd": "cat /etc/.jumpver | tail -2 | grep USEPATCHBUNDLE=2023-04-R32", "delta": "0:00:00.013547", "end": "2023-04-21 18:05:39.012868", "msg": "non-zero return code", "rc": 1, "start": "2023-04-21 18:05:38.999321", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
...ignoring
SKIPS THE RESCUE BLOCK HERE
TASK [rpm Kernel Check non-VMs] ********************************
changed: [eagnmnmep3268]
...... a bunch of other tasks run .....
PLAY RECAP ***************************
eagnmnmep3268 : ok=10 changed=10 unreachable=0 failed=0
我是新手ansible用户。我翻阅了文档,无法弄清楚为什么在“验证 PATCHBUNDLE”失败时除了救援块之外的所有内容都会执行...
Ansible 版本 2.7.5