Fix integration tests with custom inventory.

All inventory hosts to which a connection is actually established
should declare ansible_python_interpreter to avoid interpreter
auto-discovery, as that may select the wrong interpreter.
This commit is contained in:
Matt Clay 2019-03-11 17:18:39 -07:00
parent c8c326d88e
commit 759e037edc
14 changed files with 24 additions and 10 deletions

View file

@ -1,3 +1,6 @@
[local] [local]
testhost ansible_connection=local host_var_role_name=role3 testhost ansible_connection=local host_var_role_name=role3
testhost2 ansible_connection=local host_var_role_name=role2 testhost2 ansible_connection=local host_var_role_name=role2
[local:vars]
ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -1,5 +1,5 @@
[local] [local]
testhost ansible_connection=local testhost ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
[nonexistent] [nonexistent]
testhost5 ansible_host=169.254.199.200 testhost5 ansible_host=169.254.199.200 # no connection is ever established with this host

View file

@ -4,3 +4,4 @@ chroot-no-pipelining ansible_ssh_pipelining=false
[chroot:vars] [chroot:vars]
ansible_host=/ ansible_host=/
ansible_connection=chroot ansible_connection=chroot
ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -4,3 +4,4 @@ local-no-pipelining ansible_ssh_pipelining=false
[local:vars] [local:vars]
ansible_host=localhost ansible_host=localhost
ansible_connection=local ansible_connection=local
ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -4,3 +4,4 @@ paramiko_ssh-no-pipelining ansible_ssh_pipelining=false
[paramiko_ssh:vars] [paramiko_ssh:vars]
ansible_host=localhost ansible_host=localhost
ansible_connection=paramiko_ssh ansible_connection=paramiko_ssh
ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -4,3 +4,4 @@ ssh-no-pipelining ansible_ssh_pipelining=false
[ssh:vars] [ssh:vars]
ansible_host=localhost ansible_host=localhost
ansible_connection=ssh ansible_connection=ssh
ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -3,3 +3,6 @@ testhost ansible_connection=local
testhost2 ansible_connection=local testhost2 ansible_connection=local
testhost3 ansible_ssh_host=127.0.0.3 testhost3 ansible_ssh_host=127.0.0.3
testhost4 ansible_ssh_host=127.0.0.4 testhost4 ansible_ssh_host=127.0.0.4
[local:vars]
ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -8,6 +8,7 @@
name: "foo{{item}}" name: "foo{{item}}"
groups: foo groups: foo
ansible_connection: local ansible_connection: local
ansible_python_interpreter: "{{ ansible_playbook_python }}"
loop: "{{ range(10)|list }}" loop: "{{ range(10)|list }}"
# We expect all of the next 3 runs to succeeed # We expect all of the next 3 runs to succeeed

View file

@ -1,2 +1,2 @@
[local] [local]
facthost[0:25] ansible_connection=local facthost[0:25] ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -1 +1 @@
42 ansible_host=127.0.0.42 ansible_connection=local 42 ansible_host=127.0.0.42 ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -1,3 +1,6 @@
[local] [local]
testhost ansible_connection=local host_var_role_name=role3 testhost ansible_connection=local host_var_role_name=role3
testhost2 ansible_connection=local host_var_role_name=role2 testhost2 ansible_connection=local host_var_role_name=role2
[local:vars]
ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -1,3 +1,3 @@
[testgroup] [testgroup]
testhost ansible_connection=local testhost ansible_connection=local # no connection is actually established with this host
localhost localhost ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"

View file

@ -1,6 +1,6 @@
[local] [local]
testhost ansible_connection=local testhost ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
testhost2 ansible_connection=local testhost2 ansible_connection=local # connections are never made to this host, only host vars are accessed
# the following inline declarations are accompanied # the following inline declarations are accompanied
# by (preferred) group_vars/ and host_vars/ variables # by (preferred) group_vars/ and host_vars/ variables

View file

@ -1,12 +1,12 @@
[local] [local]
testhost ansible_connection=local testhost ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
[all:vars] [all:vars]
extra_var_override=FROM_INVENTORY extra_var_override=FROM_INVENTORY
inven_var=inventory_var inven_var=inventory_var
[inven_overridehosts] [inven_overridehosts]
invenoverride ansible_connection=local invenoverride ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
[inven_overridehosts:vars] [inven_overridehosts:vars]
foo=foo foo=foo