Implement enabling and disabling modules on RedHat systems

This commit is contained in:
Fabian Niepelt 2022-05-22 15:43:21 +02:00
parent 49a91fb45c
commit 841acb1b91
No known key found for this signature in database
GPG key ID: 912E90E58EF8D0B6
3 changed files with 22 additions and 6 deletions

View file

@ -40,10 +40,10 @@ apache_ignore_missing_ssl_certificate: true
apache_ssl_protocol: "All -SSLv2 -SSLv3"
apache_ssl_cipher_suite: "AES256+EECDH:AES256+EDH"
# Only used on Debian/Ubuntu.
# Only used on Debian/Ubuntu/Redhat.
apache_mods_enabled:
- rewrite.load
- ssl.load
- rewrite
- ssl
apache_mods_disabled: []
# Set initial apache state. Recommended values: `started` or `stopped`

View file

@ -11,8 +11,8 @@
- name: Enable Apache mods.
file:
src: "{{ apache_server_root }}/mods-available/{{ item }}"
dest: "{{ apache_server_root }}/mods-enabled/{{ item }}"
src: "{{ apache_server_root }}/mods-available/{{ item }}.load"
dest: "{{ apache_server_root }}/mods-enabled/{{ item }}.load"
state: link
mode: 0644
with_items: "{{ apache_mods_enabled }}"
@ -20,7 +20,7 @@
- name: Disable Apache mods.
file:
path: "{{ apache_server_root }}/mods-enabled/{{ item }}"
path: "{{ apache_server_root }}/mods-enabled/{{ item }}.load"
state: absent
with_items: "{{ apache_mods_disabled }}"
notify: restart apache

View file

@ -14,6 +14,22 @@
register: apache_ssl_certificates
with_items: "{{ apache_vhosts_ssl }}"
- name: Enable Apache mods.
copy:
dest: "{{ apache_server_root }}/conf.modules.d/99-ansible-{{ item }}.conf"
content: |
LoadModule {{ item }}_module modules/mod_{{ item }}.so
mode: 0644
with_items: "{{ apache_mods_enabled }}"
notify: restart apache
- name: Disable Apache mods
file:
path: "{{ apache_server_root }}/conf.modules.d/99-ansible-{{ item }}.conf"
state: absent
with_items: "{{ apache_mods_disabled }}"
notify: restart apache
- name: Add apache vhosts configuration.
template:
src: "{{ apache_vhosts_template }}"