Revert "Allow setting any_errors_fatal true for gather-facts"

This reverts commit 5b431f0f7f.

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
This commit is contained in:
Mark Goddard 2024-02-29 10:48:40 +00:00
parent b8146efd1c
commit 9cebdb5d9e
5 changed files with 14 additions and 22 deletions

View File

@ -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) |

View File

@ -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
###################

View File

@ -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

View File

@ -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``.

View File

@ -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 }}"