Block rescue enquiries when multiple plays.

25 views
Skip to first unread message

Zhen Jian Goh

unread,
Aug 7, 2024, 6:27:51 AM8/7/24
to Ansible Project
When trying to run 2 plays, if first one hit block rescue, why it will stop second play?

- name: Install docker.
hosts: all
tasks:
- name: Include prerequisites tasks for RedHat-based OS.
block:
- name: Include prerequisites tasks.
ansible.builtin.include_tasks: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
rescue:
- name: Install dependencies.
ansible.builtin.package:
name: "{{ docker_version }}"
use: dnf
state: present
become: true

- name: Other ansible roles.
hosts: all
roles:
- role: ansible-role-a
- role: ansible-role-b
- role: ansible-role-c


Scenario above: "Other ansible roles" won't be executed because it hit rescue in "Install docker." I thought block rescue were supposed to be used to prevent hitting errors and exit?
Reply all
Reply to author
Forward
0 new messages