Ensure that selected Apache MPM is enforced

At the moment services might have different MPM selected while all
operating the same Apache setup, ie on metal setup.
This results in failures to set selected MPMs, so eventually second run
of roles after initial deployment will end up in failure (ie upgrade).

This patch ensures that all except selected MPMs are disabled and do
role get's the desired state of deployment.

We also need to align selected MPM across all roles to avoid
future conflicts.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/929892
Change-Id: I3288c6e4060fe954b2c2725865783aa18bf6bc0d
This commit is contained in:
Dmitriy Rabotyagov 2024-09-17 20:24:04 +02:00
parent 93b7ef9b25
commit 7b19e16cbb
3 changed files with 33 additions and 4 deletions

View File

@ -142,6 +142,9 @@ skyline_pip_packages:
)
}}"
## Apache configuration
skyline_apache_mpm_backend: "{{ openstack_apache_mpm_backend | default('event') }}"
## Service Name-Group Mapping
skyline_services:
skyline-api:

View File

@ -13,6 +13,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure apache2 MPM for Debian/Ubuntu
apache2_module:
name: "{{ item.name }}"
state: "{{ item.state }}"
ignore_configcheck: yes
warn_mpm_absent: false
with_items: "{{ skyline_apache_mpms | sort(attribute='state') }}"
when:
- ansible_facts['pkg_mgr'] == 'apt'
notify: Restart web server
- name: Ensure apache2 MPM for EL
copy:
content: |
LoadModule mpm_{{ skyline_apache_mpm_backend }}_module modules/mod_mpm_{{ skyline_apache_mpm_backend }}.so
dest: /etc/httpd/conf.modules.d/00-mpm.conf
mode: "0644"
when:
- ansible_facts['pkg_mgr'] == 'dnf'
notify: Restart web server
- name: Enable apache2 modules
apache2_module:
name: "{{ item.name }}"

View File

@ -25,13 +25,17 @@ skyline_distro_packages:
skyline_system_service_name: apache2
skyline_vhost_enable_path: /etc/apache2/sites-enabled
skyline_apache_mpms:
- name: "mpm_event"
state: "{{ (skyline_apache_mpm_backend == 'event') | ternary('present', 'absent') }}"
- name: "mpm_worker"
state: "{{ (skyline_apache_mpm_backend == 'worker') | ternary('present', 'absent') }}"
- name: "mpm_prefork"
state: "{{ (skyline_apache_mpm_backend == 'prefork') | ternary('present', 'absent') }}"
skyline_apache_modules:
- name: "ssl"
state: "present"
- name: "mpm_event"
state: "absent"
- name: "mpm_worker"
state: "present"
- name: "rewrite"
state: "present"
- name: "headers"