From 9cebdb5d9eb46b5ae28a52ef86e5bb50342c3648 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 29 Feb 2024 10:48:40 +0000 Subject: [PATCH] Revert "Allow setting any_errors_fatal true for gather-facts" This reverts commit 5b431f0f7f932293362a01703673ee05d0a5bd8d. Reason for revert: the any_errors_fatal play parameter is not templated by Ansible (tested up to ansible-core 2.15.9). This behaviour is demonstrated in [1]. This means that "{{ kolla_ansible_setup_any_errors_fatal }}" is always interpreted as 'true', regardless of the value of kolla_ansible_setup_any_errors_fatal. This is particularly bad because the default value of kolla_ansible_setup_any_errors_fatal is false. We now have gather_facts_max_fail_percentage which can be set to 0 to provide the same functionality. [1] https://github.com/markgoddard/ansible-experiments/tree/master/15-fatal-errors Change-Id: I2e0ea49701b5900eae26434bcdb6b1bb44507ee7 --- ansible/gather-facts.yml | 2 -- ansible/group_vars/all.yml | 8 -------- etc/kolla/globals.yml | 8 -------- .../remove-any-errors-fatal-664fc2207074f0ef.yaml | 14 ++++++++++++++ tests/templates/globals-default.j2 | 4 ---- 5 files changed, 14 insertions(+), 22 deletions(-) create mode 100644 releasenotes/notes/remove-any-errors-fatal-664fc2207074f0ef.yaml diff --git a/ansible/gather-facts.yml b/ansible/gather-facts.yml index 59c9903f54..865d3c32f4 100644 --- a/ansible/gather-facts.yml +++ b/ansible/gather-facts.yml @@ -4,7 +4,6 @@ # building their configurations. - name: Gather facts for all hosts hosts: all - any_errors_fatal: "{{ kolla_ansible_setup_any_errors_fatal | bool }}" max_fail_percentage: >- {{ gather_facts_max_fail_percentage | default(kolla_max_fail_percentage) | @@ -40,7 +39,6 @@ # the limit. - name: Gather facts for all hosts (if using --limit) hosts: all_using_limit_True - any_errors_fatal: "{{ kolla_ansible_setup_any_errors_fatal | bool }}" max_fail_percentage: >- {{ gather_facts_max_fail_percentage | default(kolla_max_fail_percentage) | diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index e8cdca9f83..ca1b246b67 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -36,14 +36,6 @@ kolla_ansible_setup_filter: "{{ omit }}" # By default, we do not provide a gather subset. kolla_ansible_setup_gather_subset: "{{ omit }}" -# This variable is used as "any_errors_fatal" setting for the setup (gather -# facts) plays. -# This is useful for weeding out failing hosts early to avoid late failures -# due to missing facts (especially cross-host). -# Do note this still supports host fact caching and it will not affect -# scenarios with all facts cached (as there is no task to fail). -kolla_ansible_setup_any_errors_fatal: false - ################### # Kolla options ################### diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index a7ba2ebb23..d8771d5892 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -24,14 +24,6 @@ # Dummy variable to allow Ansible to accept this file. workaround_ansible_issue_8743: yes -# This variable is used as "any_errors_fatal" setting for the setup (gather -# facts) plays. -# This is useful for weeding out failing hosts early to avoid late failures -# due to missing facts (especially cross-host). -# Do note this still supports host fact caching and it will not affect -# scenarios with all facts cached (as there is no task to fail). -#kolla_ansible_setup_any_errors_fatal: false - # This variable may be used to set the maximum failure percentage for all # plays. More fine-grained control is possible via per-service variables, e.g. # nova_max_fail_percentage. The default behaviour is to set a max fail diff --git a/releasenotes/notes/remove-any-errors-fatal-664fc2207074f0ef.yaml b/releasenotes/notes/remove-any-errors-fatal-664fc2207074f0ef.yaml new file mode 100644 index 0000000000..7060d884ba --- /dev/null +++ b/releasenotes/notes/remove-any-errors-fatal-664fc2207074f0ef.yaml @@ -0,0 +1,14 @@ +--- +upgrade: + - | + Support for failing execution early if fact collection fails on any of the + hosts by setting ``kolla_ansible_setup_any_errors_fatal`` to ``true`` has + been removed. This is due to Ansible's ``any_errors_fatal`` parameter not + being templated, resulting in the value always being interpreted as + ``true``, even though the default value of + ``kolla_ansible_setup_any_errors_fatal`` is ``false``. + + Equivalent behaviour is possible by setting the maximum failure percentage + to 0. This may be done specifically for fact gathering using + ``gather_facts_max_fail_percentage`` or globally using + ``kolla_max_fail_percentage``. diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2 index e03e103d99..2301bb01d9 100644 --- a/tests/templates/globals-default.j2 +++ b/tests/templates/globals-default.j2 @@ -5,10 +5,6 @@ ansible_python_interpreter: /usr/bin/python3 {% endif %} -# NOTE(yoctozepto): In CI it makes sense to always try to fail -# as early as possible. -kolla_ansible_setup_any_errors_fatal: true - kolla_base_distro: "{{ base_distro }}" network_interface: "{{ api_interface_name }}" network_address_family: "{{ address_family }}"