File: delegate_to_template.yml

package info (click to toggle)
python-mitogen 0.3.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,708 kB
  • sloc: python: 24,457; sh: 198; makefile: 74; perl: 19; ansic: 18
file content (92 lines) | stat: -rw-r--r-- 3,079 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# issue #340: Ensure templated delegate_to field works.
#
# Here we delegate from "test-targets" group to a templated "{{physical_host}}"
# variable, which contains "cd-normal-alias", which has a
# "mitogen_via=cd-alias", which in turn has an "ansible_host="alias-host".
#
# So the full stack should be:
#   - First hop: hostname "alias-host", username "alias-user"
#   - Second hop: hostname "cd-normal-alias"

- name: integration/connection_delegation/delegate_to_template.yml
  vars:
    physical_host: "cd-normal-alias"
  hosts: test-targets
  gather_facts: no
  tasks:
    - include_tasks: ../_mitogen_only.yml
    - include_tasks: ../_expected_ssh_port.yml

    - meta: end_play
      when:
        - ansible_version_major_minor is version('2.4', '<', strict=True)

    - mitogen_get_stack:
      delegate_to: "{{ physical_host }}"
      register: out

    - assert_equal:
        left: out.result
        right: [
          {
            'kwargs': {
              'check_host_keys': 'ignore',
              'compression': True,
              'connect_timeout': 30,
              'hostname': 'alias-host',
              'identities_only': False,
              'identity_file': null,
              'keepalive_interval': 30,
              'keepalive_count': 10,
              'password': null,
              'port': null,
              'python_path': ['python3000'],
              'remote_name': null,
              'ssh_args': [
                -o, ControlMaster=auto,
                -o, ControlPersist=60s,
                -o, ForwardAgent=yes,
                -o, HostKeyAlgorithms=+ssh-rsa,
                -o, KexAlgorithms=+diffie-hellman-group1-sha1,
                -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
                -o, UserKnownHostsFile=/dev/null,
              ],
              'ssh_debug_level': 0,
              'ssh_path': 'ssh',
              'username': 'alias-user',
            },
            'method': 'ssh',
          },
          {
            'kwargs': {
              'check_host_keys': 'ignore',
              'compression': True,
              'connect_timeout': 30,
              'hostname': 'cd-normal-alias',
              'identities_only': False,
              'identity_file': null,
              'keepalive_interval': 30,
              'keepalive_count': 10,
              'password': null,
              'port': '{{ expected_ssh_port }}',
              'python_path': ['python3000'],
              'remote_name': null,
              'ssh_args': [
                -o, ControlMaster=auto,
                -o, ControlPersist=60s,
                -o, ForwardAgent=yes,
                -o, HostKeyAlgorithms=+ssh-rsa,
                -o, KexAlgorithms=+diffie-hellman-group1-sha1,
                -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
                -o, UserKnownHostsFile=/dev/null,
              ],
              'ssh_debug_level': 0,
              'ssh_path': 'ssh',
              'username': 'ansible-cfg-remote-user',
            },
            'method': 'ssh',
          }
        ]
  tags:
    - delegate_to_template
    - mitogen_only