Fix ordering error enabling/disabling Apache modules

When site configuration already exists, a change to make a module
'absent' would fail as the module was removed before the
configuration.

This change ensures modules are enabled first, before site
configuration changes, and finally any required modules are
disabled.

Change-Id: I56a6c47e4d95e86dc1e0d731f1e39eeec6ac7dc8
This commit is contained in:
Andrew Bonney 2022-01-10 14:13:43 +00:00
parent dfa253d72c
commit 236f11c31d

View File

@ -32,6 +32,20 @@
owner: "{{ keystone_apache_default_log_owner }}"
group: "{{ keystone_apache_default_log_grp }}"
## NOTE(cloudnull):
## Module enable/disable process is only functional on Debian
- name: Enable apache2 modules
apache2_module:
name: "{{ item.name }}"
state: "{{ item.state }}"
with_items: "{{ keystone_apache_modules }}"
when:
- ansible_facts['pkg_mgr'] == 'apt'
- item.state == 'present'
notify:
- Manage LB
- Restart web server
- name: Place apache2 config files
template:
src: "{{ item.src }}"
@ -45,13 +59,14 @@
## NOTE(cloudnull):
## Module enable/disable process is only functional on Debian
- name: Enable/disable apache2 modules
- name: Disable apache2 modules
apache2_module:
name: "{{ item.name }}"
state: "{{ item.state }}"
with_items: "{{ keystone_apache_modules }}"
when:
- ansible_facts['pkg_mgr'] == 'apt'
- item.state == 'absent'
notify:
- Manage LB
- Restart web server