From ee3b273876af0b87ab73aa0e2d9343a15044f082 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 10 Jul 2019 10:05:18 -0700 Subject: [PATCH] Exclude ansible_python_interpreter from write-inventory Zuul now includes an ansible_python_interpreter hostvar in every host in its inventory. It defaults to python2. The write-inventory role, which takes the Zuul inventory and makes an inventory for the fake bridge server in the gate passes that through. Because it's in /etc/ansible/inventory.yaml, it overrides any settings which may arrive via group vars, but this is the way we set the interpreter for all the hosts on bridge (we do not do so in the actual inventory file). To correct this, tell write-inventory to strip the ansible_python_interpreter variable when it writes out the new inventory. This restores the behavior to match what happens on the real bridge host. One instance of setting the interpreter for the fake "trusty" host used in base platform tests is moved to a hostvars file to match the rest of the real hosts. Change-Id: I60f0acb64e7b90ed8af266f21f2114fd598f4a3c --- .zuul.yaml | 3 --- playbooks/host_vars/trusty.yaml | 3 +++ playbooks/zuul/run-base.yaml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 playbooks/host_vars/trusty.yaml diff --git a/.zuul.yaml b/.zuul.yaml index ec8413dbf1..716e4452ff 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -379,9 +379,6 @@ label: ubuntu-xenial - name: bionic label: ubuntu-bionic - host-vars: - trusty: - ansible_python_interpreter: python2 files: - playbooks/.* - roles/.* diff --git a/playbooks/host_vars/trusty.yaml b/playbooks/host_vars/trusty.yaml new file mode 100644 index 0000000000..3d2c988502 --- /dev/null +++ b/playbooks/host_vars/trusty.yaml @@ -0,0 +1,3 @@ +# This is a fake host used in gate testing of the base playbook on +# each supported platform. +ansible_python_interpreter: python2 diff --git a/playbooks/zuul/run-base.yaml b/playbooks/zuul/run-base.yaml index e412df1c1a..5964e93f8d 100644 --- a/playbooks/zuul/run-base.yaml +++ b/playbooks/zuul/run-base.yaml @@ -13,6 +13,7 @@ write_inventory_dest: /etc/ansible/hosts/inventory.yaml write_inventory_exclude_hostvars: - ansible_user + - ansible_python_interpreter - name: Set up /opt/system-config repo git: repo: /home/zuul/src/opendev.org/opendev/system-config