From 236f11c31d6b2d395a9ec8846e240841510825ce Mon Sep 17 00:00:00 2001 From: Andrew Bonney Date: Mon, 10 Jan 2022 14:13:43 +0000 Subject: [PATCH] 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 --- tasks/keystone_apache.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tasks/keystone_apache.yml b/tasks/keystone_apache.yml index f89c3b40..7005689e 100644 --- a/tasks/keystone_apache.yml +++ b/tasks/keystone_apache.yml @@ -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