Skip to content

Commit 3e5fad6

Browse files
authored
Fix occasional update_cache idempotence failure (#31)
1 parent ba0aacc commit 3e5fad6

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ BUG FIXES:
1111
* Rename handlers to use more specific role related naming and prevent namespace collision issues.
1212
* Add a `nginx_app_protect_service_modify` variable to revert a breaking change introduced in 0.3.0 where timeouts would not be set by default.
1313
* Set NGINX handler to `state: restarted` to prevent some compatibility issues when NGINX App Protect is installed on an instance already running NGINX beforehand.
14+
* Using `update_cache: true` by itself in the `apt` module is not always idempotent. Moved the NGINX App Protect installation task to a corresponding `apt` or `yum` module to avoid this scenario.
1415

1516
## 0.3.0 (September 21, 2020)
1617

tasks/install/install-app-protect.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,8 @@
1414
quiet: true
1515
when: nginx_plus_version is defined
1616

17-
- name: Set up NGINX App Protect repositories
18-
include_tasks: "{{ role_path }}/tasks/install/setup-{{ ansible_facts['os_family'] | lower }}.yml"
19-
when: nginx_app_protect_state != "absent"
20-
2117
- name: Install NGINX App Protect
22-
package:
23-
name: "app-protect{{ nginx_app_protect_version | default('') }}"
24-
state: "{{ nginx_app_protect_state }}"
25-
notify: (Handler - NGINX App Protect) Run NGINX
18+
include_tasks: "{{ role_path }}/tasks/install/install-{{ ansible_facts['os_family'] | lower }}.yml"
2619

2720
- name: Install latest NGINX App Protect signatures
2821
package:

tasks/install/setup-debian.yml renamed to tasks/install/install-debian.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
update_cache: false
4141
state: "{{ nginx_app_protect_license_status | default ('present') }}"
4242

43-
- name: (Debian/Ubuntu) Update the apt cache
43+
- name: (Debian/Ubuntu) Install NGINX App Protect
4444
apt:
45+
name: "app-protect{{ nginx_app_protect_version | default('') }}"
46+
state: "{{ nginx_app_protect_state }}"
4547
update_cache: true
48+
notify: (Handler - NGINX App Protect) Run NGINX

tasks/install/setup-redhat.yml renamed to tasks/install/install-redhat.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@
2020
enabled: true
2121
gpgcheck: true
2222
state: "{{ nginx_app_protect_license_status | default ('present') }}"
23+
24+
- name: (CentOS/RHEL) Install NGINX App Protect
25+
yum:
26+
name: "app-protect{{ nginx_app_protect_version | default('') }}"
27+
state: "{{ nginx_app_protect_state }}"
28+
update_cache: true
29+
notify: (Handler - NGINX App Protect) Run NGINX

0 commit comments

Comments
 (0)