Execution
Date 14 Dec 2025 10:15:01 +0000
Duration 00:06:33.21
Controller aio1.openstack.local
User root
Versions
Ansible 2.18.6
ara 1.7.4 / 1.7.4
Python 3.13.5
Summary
7 Hosts
567 Tasks
554 Results
37 Plays
221 Files
0 Records

File: /home/zuul/src/opendev.org/openstack/ansible-role-httpd/tasks/httpd_post_install.yml

---
# Copyright 2024, Cleura AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Ensure apache2 MPM for Debian/Ubuntu
  community.general.apache2_module:
    name: "{{ item.name }}"
    state: "{{ item.state }}"
    ignore_configcheck: true
    warn_mpm_absent: false
  with_items: "{{ httpd_mpms | sort(attribute='state') }}"
  when:
    - ansible_facts['pkg_mgr'] == 'apt'
  notify: Restart web server

- name: Ensure apache2 MPM for EL
  ansible.builtin.copy:
    content: |
      LoadModule mpm_{{ httpd_mpm_backend }}_module modules/mod_mpm_{{ httpd_mpm_backend }}.so

    dest: "{{ httpd_conf_dir }}/conf.modules.d/00-mpm.conf"
    mode: "0644"
  when:
    - ansible_facts['pkg_mgr'] == 'dnf'
  notify: Restart web server

- name: Enable apache2 modules
  community.general.apache2_module:
    name: "{{ item.name }}"
    state: "{{ item.state }}"
    ignore_configcheck: true
  with_items: "{{ httpd_modules }}"
  when:
    - ansible_facts['pkg_mgr'] == 'apt'
  notify: Restart web server

- name: Disable default apache site
  ansible.builtin.file:
    path: "{{ item }}"
    state: "absent"
  with_items: "{{ httpd_default_sites }}"
  notify: Restart web server

- name: Ensure Apache configuration
  ansible.builtin.lineinfile:
    dest: "{{ httpd_conf_file }}"
    line: "{{ item }}"
    regexp: "^{{ item | split() | first }}"
  notify: Restart web server
  with_items:
    - "ServerName {{ httpd_server_name }}"
    - "ErrorLog syslog:daemon"
    - "LogLevel {{ httpd_log_level }}"

- name: Apply Apache extra configuration
  ansible.builtin.template:
    src: "{{ item['src'] }}"
    dest: "{{ item['dest'] }}"
    owner: "{{ item['owner'] }}"
    group: "{{ item['group'] }}"
    mode: "0644"
  with_items: "{{ httpd_extra_conf_files }}"
  notify: Restart web server

- name: Remove Listen from Apache config
  ansible.builtin.lineinfile:
    dest: "{{ httpd_security_conf }}"
    regexp: "^(Listen.*)"
    backrefs: true
    line: "#\\1"
  notify: Restart web server