Workaround ansible unsafe text templating bug

See https://github.com/ansible/ansible/issues/82598

Setting the 'use' parameter to something other than 'auto'
should cause a different code path to be use in the package
action plugin which could avoid the templating unsafe text
inside the plugin.

Change-Id: I0c14510eb625d74a654a6398387ab74c4355a4e8
This commit is contained in:
Jonathan Rosser 2024-02-28 08:51:29 +00:00
parent c2c961317a
commit d80a61f810
2 changed files with 4 additions and 0 deletions

View File

@ -25,6 +25,7 @@
# Perhaps do this if the distro/architecture of the target host differs
# from the build host.
# NOTE(jrosser) remove the use: parameter when https://github.com/ansible/ansible/issues/82598 is fixed
- name: Install distro packages for venv build
package:
name: >-
@ -42,6 +43,7 @@
state: "{{ venv_distro_package_state }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(venv_distro_cache_valid_time, omit) }}"
use: "{{ ansible_facts['pkg_mgr'] }}"
when:
- ((venv_build_base_distro_package_list | union(venv_build_distro_package_list)) | length > 0) or
((venv_install_base_distro_package_list | union(venv_install_distro_package_list)) | length > 0)

View File

@ -16,6 +16,7 @@
- name: Build the wheels on the build host
delegate_to: "{{ venv_build_host }}"
block:
# NOTE(jrosser) remove the use: parameter when https://github.com/ansible/ansible/issues/82598 is fixed
- name: Install distro packages for wheel build
vars:
_python_wheel_build_package_list: "{{ venv_build_base_distro_package_list | union(venv_build_distro_package_list) }}"
@ -24,6 +25,7 @@
state: "{{ venv_distro_package_state }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(venv_distro_cache_valid_time, omit) }}"
use: "{{ ansible_facts['pkg_mgr'] }}"
when:
- _python_wheel_build_package_list | length > 0
register: _install_build_distro_packages