From cd3449bd452dabd29ecd657a98bde26be1aaf750 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 12 Jan 2026 09:26:14 -0700 Subject: [PATCH] ci: use ANSIBLE_INJECT_FACT_VARS=false by default for testing Ansible 2.20 has deprecated the use of Ansible facts as variables. For example, `ansible_distribution` is now deprecated in favor of `ansible_facts["distribution"]`. This is due to making the default setting `INJECT_FACTS_AS_VARS=false`. For now, this will create WARNING messages, but in Ansible 2.24 it will be an error. In order to ensure that commits and PRs conform to this, use ANSIBLE_INJECT_FACT_VARS=false by default in our CI testing. See https://docs.ansible.com/projects/ansible/latest/porting_guides/porting_guide_core_2.20.html#inject-facts-as-vars Signed-off-by: Rich Megginson --- .github/workflows/qemu-kvm-integration-tests.yml | 1 + .github/workflows/tft.yml | 1 + tests/vars/rh_distros_vars.yml | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/qemu-kvm-integration-tests.yml b/.github/workflows/qemu-kvm-integration-tests.yml index 470840e3..55801c92 100644 --- a/.github/workflows/qemu-kvm-integration-tests.yml +++ b/.github/workflows/qemu-kvm-integration-tests.yml @@ -44,6 +44,7 @@ jobs: env: TOX_ARGS: "--skip-tags tests::infiniband,tests::nvme,tests::scsi" + ANSIBLE_INJECT_FACT_VARS: "false" steps: - name: Checkout repo diff --git a/.github/workflows/tft.yml b/.github/workflows/tft.yml index 0d97f4f0..0c9f97d4 100644 --- a/.github/workflows/tft.yml +++ b/.github/workflows/tft.yml @@ -168,6 +168,7 @@ jobs: SR_ARTIFACTS_DIR=${{ steps.set_vars.outputs.ARTIFACTS_DIR }};\ SR_TEST_LOCAL_CHANGES=false;\ SR_LSR_USER=${{ vars.SR_LSR_USER }};\ + SR_ANSIBLE_INJECT_FACT_VARS=false;\ SR_ARTIFACTS_URL=${{ steps.set_vars.outputs.ARTIFACTS_URL }}" # Note that LINUXSYSTEMROLES_SSH_KEY must be single-line, TF doesn't read multi-line variables fine. secrets: "SR_LSR_DOMAIN=${{ secrets.SR_LSR_DOMAIN }};\ diff --git a/tests/vars/rh_distros_vars.yml b/tests/vars/rh_distros_vars.yml index fd9b377e..ba453a99 100644 --- a/tests/vars/rh_distros_vars.yml +++ b/tests/vars/rh_distros_vars.yml @@ -14,7 +14,7 @@ __bootloader_rh_distros: __bootloader_rh_distros_fedora: "{{ __bootloader_rh_distros + ['Fedora'] }}" # Use this in conditionals to check if distro is Red Hat or clone -__bootloader_is_rh_distro: "{{ ansible_facts['distribution'] in __bootloader_rh_distros }}" +__bootloader_is_rh_distro: "{{ ansible_distribution in __bootloader_rh_distros }}" # Use this in conditionals to check if distro is Red Hat or clone, or Fedora -__bootloader_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __bootloader_rh_distros_fedora }}" +__bootloader_is_rh_distro_fedora: "{{ ansible_distribution in __bootloader_rh_distros_fedora }}"