[CI] Fix testing inventory template due Ansible 2.16.14 breakage
Ansible 2.16.14 includes a fix for CVE-2024-11079 [1], which results in the following error: jinja2.exceptions.UndefinedError: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_host' This issue occurs because Ansible now includes `localhost` in `hostvars` without the `ansible_host` variable set, which unexpectedly breaks our test inventory rendering. This patch adds a filter to exclude `localhost` during the rendering process, as it is irrelevant for our purposes. [1] https://github.com/ansible/ansible/pull/84353 Change-Id: Ie7ae47e5a624da31cf6cc5cd3c9239450487b8ed
This commit is contained in:
parent
ecdd7462aa
commit
0298699a4b
@ -11,7 +11,7 @@
|
|||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% for host in hostvars %}
|
{% for host in hostvars | reject('equalto', 'localhost') %}
|
||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -31,28 +31,28 @@ control
|
|||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% for host in hostvars %}
|
{% for host in hostvars | reject('equalto', 'localhost') %}
|
||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
[storage]
|
[storage]
|
||||||
{% for host in hostvars %}
|
{% for host in hostvars | reject('equalto', 'localhost') %}
|
||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
[monitoring]
|
[monitoring]
|
||||||
{% for host in hostvars %}
|
{% for host in hostvars | reject('equalto', 'localhost') %}
|
||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
[deployment]
|
[deployment]
|
||||||
{% for host in hostvars %}
|
{% for host in hostvars | reject('equalto', 'localhost') %}
|
||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if scenario == 'cells' %}
|
{% if scenario == 'cells' %}
|
||||||
{% for host in hostvars %}
|
{% for host in hostvars | reject('equalto', 'localhost') %}
|
||||||
{% set cell_name = 'cell' ~ loop.index %}
|
{% set cell_name = 'cell' ~ loop.index %}
|
||||||
[{{ cell_name }}]
|
[{{ cell_name }}]
|
||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} mariadb_shard_id={{ loop.index0 % 2 }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} mariadb_shard_id={{ loop.index0 % 2 }}
|
||||||
@ -123,7 +123,7 @@ storage
|
|||||||
# In CI we want Pacemaker to run on primary and secondary (to test with HA).
|
# In CI we want Pacemaker to run on primary and secondary (to test with HA).
|
||||||
|
|
||||||
[hacluster]
|
[hacluster]
|
||||||
{% for host in hostvars %}
|
{% for host in hostvars | reject('equalto', 'localhost') %}
|
||||||
{% if host in ['primary', 'secondary'] %}
|
{% if host in ['primary', 'secondary'] %}
|
||||||
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user