ansible-role-apache/tasks/apache-modules-el.yml

29 lines
1.1 KiB
YAML

---
# a2enmod does not exist on EL, and the apache2_module Ansible module requires
# both a2enmod and a2dismod: the module list of the httpd role this one absorbs
# could never be applied there. On EL the distribution loads its modules from
# conf.modules.d, the MPM is selected by apache-config-el.yml, and this file only
# adds the ones the distribution does not load by default.
- name: apache-modules-el | Load the extra modules, if any
ansible.builtin.copy:
content: |
# {{ ansible_managed }}
{% for mod in apache_el_extra_modules %}
LoadModule {{ mod.identifier }} modules/{{ mod.file }}
{% endfor %}
dest: '{{ apache_base_conf_dir }}/conf.modules.d/50-ansible-extra.conf'
owner: root
group: root
mode: '0444'
when: apache_el_extra_modules | length > 0
notify: apache2 restart
tags: [ 'apache', 'apache_mods' ]
- name: apache-modules-el | Remove the extra modules file when the list is empty
ansible.builtin.file:
dest: '{{ apache_base_conf_dir }}/conf.modules.d/50-ansible-extra.conf'
state: absent
when: apache_el_extra_modules | length == 0
notify: apache2 restart
tags: [ 'apache', 'apache_mods' ]