summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/delegate_to/delegate_vars_hanldling.yml
blob: 6ac64e9ced90d5d22a61c3b0cba60ea87f8a90ff (plain)
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
- name: setup delegated hsot
  hosts: localhost
  gather_facts: false
  tasks:
    - add_host:
        name: delegatetome
        ansible_host: 127.0.0.4

- name: ensure we dont use orig host vars if delegated one does not define them
  hosts: testhost
  gather_facts: false
  connection: local
  tasks:
    - name: force current host to use winrm
      set_fact:
        ansible_connection: winrm

    - name: this should fail (missing winrm or unreachable)
      ping:
      ignore_errors: true
      ignore_unreachable: true
      register: orig

    - name: ensure prev failed
      assert:
        that:
            - orig is failed or orig is unreachable

    - name: this will only fail if we take orig host ansible_connection instead of defaults
      ping:
      delegate_to: delegatetome


- name: ensure plugin specific vars are properly used
  hosts: testhost
  gather_facts: false
  tasks:
    - name: set unusable ssh args
      set_fact:
         ansible_host: 127.0.0.1
         ansible_connection: ssh
         ansible_ssh_common_args: 'MEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE'
         ansible_connection_timeout: 5

    - name: fail to ping with bad args
      ping:
      register: bad_args_ping
      ignore_unreachable: true

    - debug: var=bad_args_ping
    - name: ensure prev failed
      assert:
        that:
            - bad_args_ping is failed or bad_args_ping is unreachable

    - name: this should work by ignoring the bad ags for orig host
      ping:
      delegate_to: delegatetome