Skip to content

Commit 3a37ac4

Browse files
authored
Ansible check mode fails if NGINX is not installed (#171)
1 parent ea54d15 commit 3a37ac4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ BUG FIXES:
1717

1818
* Role was failing to uninstall NGINX App Protect DoS packages when the `nginx_app_protect_dos_state` was set to `absent`.
1919
* Uninstallation scenario was unintentionally creating repository entries.
20+
* Ansible check mode runs will no longer fail if NGINX has not yet been installed.
2021

2122
## 0.7.1 (February 16, 2022)
2223

handlers/main.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515

1616
- name: (Handler - NGINX App Protect) Check NGINX
1717
command: nginx -t
18-
register: config
18+
register: config_check
1919
ignore_errors: true
2020
changed_when: false
2121
listen: (Handler - NGINX App Protect) Run NGINX
2222

2323
- name: (Handler - NGINX App Protect) Print NGINX error if syntax check fails
2424
debug:
25-
var: config.stderr_lines
26-
failed_when: config.rc != 0
25+
var: config_check.stderr_lines
26+
failed_when: config_check.rc != 0
2727
when:
28-
- config.rc is defined
29-
- config.rc != 0
28+
- config_check.stderr_lines is defined
29+
- config_check.stderr_lines != []
30+
- config_check.rc != 0
3031
listen: (Handler - NGINX App Protect) Run NGINX

0 commit comments

Comments
 (0)