File: issue_1066__add_host__host_key_checking.yml

package info (click to toggle)
python-mitogen 0.3.44-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,824 kB
  • sloc: python: 24,965; sh: 144; makefile: 74; perl: 19; ansic: 18
file content (71 lines) | stat: -rw-r--r-- 2,981 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
- name: regression/issue_1066__add_host__host_key_checking.yml
  hosts: test-targets[0]
  gather_facts: false
  become: false
  tasks:
    - name: Add hosts dynamically
      add_host:
        name: "{{ item.name }}"
        ansible_host_key_checking:        "{{ item.host_key_checking | default(omit) }}"
        ansible_ssh_host_key_checking:    "{{ item.host_ssh_key_checking | default(omit) }}"
        ansible_host:                     "{{ hostvars[inventory_hostname].ansible_host | default(omit) }}"
        ansible_password:                 "{{ hostvars[inventory_hostname].ansible_password | default(omit) }}"
        ansible_port:                     "{{ hostvars[inventory_hostname].ansible_port | default(omit) }}"
        ansible_python_interpreter:       "{{ hostvars[inventory_hostname].ansible_python_interpreter | default(omit) }}"
        ansible_user:                     "{{ hostvars[inventory_hostname].ansible_user | default(omit) }}"
      loop:
        - {name: issue-1066-host-hkc-false,   host_key_checking: false}
        - {name: issue-1066-host-hkc-true,    host_key_checking: true}
        - {name: issue-1066-host-hskc-false,  host_ssh_key_checking: false}
        - {name: issue-1066-host-hskc-true,   host_ssh_key_checking: true}
      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
  serial: 1
  tasks:
    # FIXME https://github.com/mitogen-hq/mitogen/issues/1096
    - meta: end_play
      when:
        - ansible_version_major_minor is version('2.17', '>=', strict=True)
    - meta: reset_connection

    # The host key might be in ~/.ssh/known_hosts. If it's removed then no
    # problem - test-targets hosts have host_key_checking=false.
    - name: Remove existing host keys
      known_hosts:
        name: "{{ ansible_host }}"
        state: absent
      delegate_to: localhost

    - name: Ping dynamically added hosts
      ping:
      ignore_errors: true
      ignore_unreachable: true
      register: issue_1066_ping

    - debug:
        var: issue_1066_ping

    - name: Confirm dynamically added hosts are/are not reachable
      vars:
        expected:
          issue-1066-host-hkc-false:    {}
          issue-1066-host-hkc-true:     {unreachable: true}
          issue-1066-host-hskc-false:   {}
          issue-1066-host-hskc-true:    {unreachable: true}
      assert:
        that:
          - issue_1066_ping.unreachable is defined == expected[inventory_hostname].unreachable is defined
          - issue_1066_ping.unreachable | default(42) == expected[inventory_hostname].unreachable | default(42)
      # ansible_host_key_checking don't work on Vanilla Ansible 2.10, even for
      # static inventory hosts (ansible/ansible#49254, ansible/ansible#73708).
      when:
        - ansible_version_major_minor is version('2.11', '>=', strict=True)
          or is_mitogen
  tags:
    - issue_1066