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
This commit is contained in:
James E. Blair 2019-07-10 10:05:18 -07:00
parent 6d66d7ca34
commit ee3b273876
3 changed files with 4 additions and 3 deletions

View File

@ -379,9 +379,6 @@
label: ubuntu-xenial
- name: bionic
label: ubuntu-bionic
host-vars:
trusty:
ansible_python_interpreter: python2
files:
- playbooks/.*
- roles/.*

View File

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

View File

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