Use conditions with Host prep block tasks

Ansible free/tripleo_free strategies do not work well
for blocks with conditions, containing include_tasks.
Conditions ( i.e when: ) at times get mixed up resulting
in wrong condition being evaluated. As blocks are only
logical entities (conditions evaluated per task), we
shouldn't have any problem moving the conditions to tasks
in Host prep block to avoid the issue.

This fixes intermittent chrony failures in host_prep_tasks.

Note: This is a workaround as we've to backport it all
the way till train and has to be fixed in core ansible[1]
in the future.

[1] https://github.com/ansible/ansible/issues/60512

Resolves: rhbz#2084075
Resolves: rhbz#2111237
Change-Id: Id9f481f3fe75169bd4c3d721e23e847a1b6c8c43
(cherry picked from commit e728e8cc8e)
(cherry picked from commit 492005071a)
This commit is contained in:
Rabi Mishra 2022-08-02 22:27:51 +05:30
parent 603591963f
commit 81840e9346
1 changed files with 6 additions and 3 deletions

View File

@ -639,15 +639,18 @@ outputs:
tasks:
{%- for role in roles %}
- name: {{role.name}} Host prep block
when:
- tripleo_role_name == '{{role.name}}'
block:
- name: {{role.name}} Host prep steps
delegate_to: localhost
run_once: true
debug:
msg: Use --start-at-task '{{role.name}} Host prep steps' to resume from this task
- include_tasks: {{role.name}}/host_prep_tasks.yaml
when:
- tripleo_role_name == '{{role.name}}'
- name: {{role.name}} Host prep tasks
include_tasks: {{role.name}}/host_prep_tasks.yaml
when:
- tripleo_role_name == '{{role.name}}'
{%- endfor %}
tags:
- overcloud