|
20 | 20 | failed_when: (service is changed) or (service is failed)
|
21 | 21 |
|
22 | 22 | - name: Functional tests
|
23 |
| - when: ansible_os_family != "Alpine" |
| 23 | + when: ansible_facts['os_family'] != 'Alpine' |
24 | 24 | block:
|
25 | 25 | - name: Check that a page returns a status 200 and fail if the words Hello World are not in the page contents
|
26 | 26 | ansible.builtin.uri:
|
27 | 27 | url: http://localhost
|
28 | 28 | return_content: true
|
29 | 29 | register: this
|
30 |
| - failed_when: "'Hello World' not in this.content" |
| 30 | + failed_when: "'Hello World' not in this['content']" |
31 | 31 |
|
32 | 32 | - name: Check that a page returns a status 200 and fail if the words Request Rejected are not in the page contents
|
33 | 33 | ansible.builtin.uri:
|
34 | 34 | url: http://localhost/?v=<script>
|
35 | 35 | return_content: true
|
36 | 36 | register: this
|
37 |
| - failed_when: "'Request Rejected' not in this.content" |
| 37 | + failed_when: "'Request Rejected' not in this['content']" |
38 | 38 |
|
39 | 39 | - name: Ensure /var/log/messages contains block event from above test
|
40 | 40 | ansible.builtin.shell: grep -c "Non-browser Client,Abuse of Functionality,Cross Site Scripting (XSS)" /var/log/messages || true
|
41 | 41 | register: event
|
42 | 42 | changed_when: false
|
43 |
| - failed_when: event.stdout == "0" |
| 43 | + failed_when: event['stdout'] == '0' |
44 | 44 |
|
45 | 45 | - name: Check default.conf exists
|
46 | 46 | ansible.builtin.stat:
|
47 | 47 | path: /etc/nginx/conf.d/default.conf
|
48 | 48 | check_mode: true
|
49 | 49 | register: stat_result
|
50 |
| - failed_when: not stat_result.stat.exists |
| 50 | + failed_when: not stat_result['stat']['exists'] | bool |
51 | 51 |
|
52 | 52 | - name: Check frontend_default.conf exists
|
53 | 53 | ansible.builtin.stat:
|
54 | 54 | path: /etc/nginx/conf.d/frontend_default.conf
|
55 | 55 | check_mode: true
|
56 | 56 | register: stat_result
|
57 |
| - failed_when: not stat_result.stat.exists |
| 57 | + failed_when: not stat_result['stat']['exists'] | bool |
58 | 58 |
|
59 | 59 | - name: Check backend_default.conf exists
|
60 | 60 | ansible.builtin.stat:
|
61 | 61 | path: /etc/nginx/conf.d/backend_default.conf
|
62 | 62 | check_mode: true
|
63 | 63 | register: stat_result
|
64 |
| - failed_when: not stat_result.stat.exists |
| 64 | + failed_when: not stat_result['stat']['exists'] | bool |
65 | 65 |
|
66 | 66 | - name: Ensure default.conf contains 'location /'
|
67 | 67 | ansible.builtin.lineinfile:
|
|
0 commit comments