tests: Regression test for add_host with host_key_checking

refs # 1 0 6 6
pull/1068/head
Alex Willmer 4 weeks ago
parent 0f34e2505b
commit d6949a23be

@ -62,6 +62,8 @@ with ci_lib.Fold('job_setup'):
"ansible_python_interpreter=%(python_path)s "
"ansible_user=mitogen__has_sudo_nopw "
"ansible_password=has_sudo_nopw_password"
" ansible_host_key_checking=false"
" ansible_ssh_host_key_checking=false"
"\n"
% container
for container in containers

@ -37,9 +37,6 @@ no_target_syslog = True
# Required by integration/ssh/timeouts.yml
timeout = 30
# On Travis, paramiko check fails due to host key checking enabled.
host_key_checking = False
[inventory]
any_unparsed_is_failed = true
host_pattern_mismatch = error

@ -6,7 +6,7 @@
# fixed ansible.cfg remote_user setting to test against.
# FIXME Hardcoded by replacement in some CI runs https://github.com/mitogen-hq/mitogen/issues/1022
# and os.environ['USER'] is not populated on Azure macOS runners.
target ansible_host=localhost ansible_user="{{ lookup('pipe', 'whoami') }}"
target ansible_host=localhost ansible_user="{{ lookup('pipe', 'whoami') }}" ansible_host_key_checking=false ansible_ssh_host_key_checking=false
[test-targets]
target

@ -0,0 +1,3 @@
# See also
# - regression/issue_1066__add_host__host_key_checking.yml
host_key_checking: false

@ -15,3 +15,4 @@
- import_playbook: issue_655__wait_for_connection_error.yml
- import_playbook: issue_776__load_plugins_called_twice.yml
- import_playbook: issue_952__ask_become_pass.yml
- import_playbook: issue_1066__add_host__host_key_checking.yml

@ -0,0 +1,36 @@
- name: regression/issue_1066__add_host__host_key_checking.yml
hosts: test-targets[0]
gather_facts: false
become: false
vars:
issue_1066_ansible_host: "{{ hostvars[groups['test-targets'][0]].ansible_host }}"
tasks:
# The host key might be in ~/.ssh/known_hosts. If it's removed then no
# problem - test-targets hosts have host_key_checking=false.
# See also:
# - hosts/group_vars/test-targets.yml
- name: Remove existing host keys
known_hosts:
name: "{{ issue_1066_ansible_host }}"
state: absent
delegate_to: localhost
- name: Add host dynamically
add_host:
name: issue-1066-host
ansible_host_key_checking: false
ansible_host: "{{ issue_1066_ansible_host }}"
delegate_to: localhost
tags:
- issue_1066
- name: regression/issue_1066__add_host__host_key_checking.yml
hosts: issue-1066-host
gather_facts: false
become: false
tasks:
- name: Confirm new host can be reached
ping:
tags:
- issue_1066

@ -9,6 +9,7 @@
- $(groups): "{{ lookup('pipe', 'groups') }}"
- $(pwd): "{{ lookup('pipe', 'pwd') }}"
- $(whoami): "{{ lookup('pipe', 'whoami') }}"
- ansible_inventory_sources: "{{ ansible_inventory_sources | default('<unset>') }}"
- ansible_run_tags: "{{ ansible_run_tags | default('<unset>') }}"
- ansible_playbook_python: "{{ ansible_playbook_python | default('<unset>') }}"
- ansible_skip_tags: "{{ ansible_skip_tags | default('<unset>') }}"

Loading…
Cancel
Save