|
8 | 8 | vars: |
9 | 9 | ansible_become_pass: has_sudo_pubkey_password |
10 | 10 | tasks: |
11 | | - |
12 | 11 | - mitogen_test_gethostbyname: |
13 | 12 | name: www.google.com |
14 | 13 | register: out |
15 | | - when: | |
16 | | - ansible_virtualization_type == "docker" and |
17 | | - ansible_python_version > "2.5" |
| 14 | + when: |
| 15 | + - ansible_facts.virtualization_type == "docker" |
| 16 | + - ansible_facts.python.version_info[:2] >= [2, 5] |
18 | 17 |
|
19 | 18 | - shell: cp /etc/resolv.conf /tmp/resolv.conf |
20 | | - when: | |
21 | | - ansible_virtualization_type == "docker" and |
22 | | - ansible_python_version > "2.5" |
| 19 | + when: |
| 20 | + - ansible_facts.virtualization_type == "docker" |
| 21 | + - ansible_facts.python.version_info[:2] >= [2, 5] |
23 | 22 |
|
24 | 23 | - shell: echo > /etc/resolv.conf |
25 | | - when: | |
26 | | - ansible_virtualization_type == "docker" and |
27 | | - ansible_python_version > "2.5" |
| 24 | + when: |
| 25 | + - ansible_facts.virtualization_type == "docker" |
| 26 | + - ansible_facts.python.version_info[:2] >= [2, 5] |
28 | 27 |
|
29 | 28 | - mitogen_test_gethostbyname: |
30 | 29 | name: www.google.com |
31 | 30 | register: out |
32 | 31 | ignore_errors: true |
33 | | - when: | |
34 | | - ansible_virtualization_type == "docker" and |
35 | | - ansible_python_version > "2.5" |
| 32 | + when: |
| 33 | + - ansible_facts.virtualization_type == "docker" |
| 34 | + - ansible_facts.python.version_info[:2] >= [2, 5] |
36 | 35 |
|
37 | 36 | - shell: cat /tmp/resolv.conf > /etc/resolv.conf |
38 | | - when: | |
39 | | - ansible_virtualization_type == "docker" and |
40 | | - ansible_python_version > "2.5" |
| 37 | + when: |
| 38 | + - ansible_facts.virtualization_type == "docker" |
| 39 | + - ansible_facts.python.version_info[:2] >= [2, 5] |
41 | 40 |
|
42 | 41 | - assert: |
43 | 42 | that: |
44 | 43 | - out.failed |
45 | 44 | - '"Name or service not known" in out.msg or |
46 | 45 | "Temporary failure in name resolution" in out.msg' |
47 | 46 | fail_msg: out={{out}} |
48 | | - when: | |
49 | | - ansible_virtualization_type == "docker" and |
50 | | - ansible_python_version > "2.5" |
| 47 | + when: |
| 48 | + - ansible_facts.virtualization_type == "docker" |
| 49 | + - ansible_facts.python.version_info[:2] >= [2, 5] |
51 | 50 | tags: |
52 | 51 | - resolv_conf |
0 commit comments