diff --git a/defaults/main.yml b/defaults/main.yml index 21d7726..9c979af 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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` diff --git a/tasks/configure-Debian.yml b/tasks/configure-Debian.yml index e9b2ad4..0932f37 100644 --- a/tasks/configure-Debian.yml +++ b/tasks/configure-Debian.yml @@ -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 diff --git a/tasks/configure-RedHat.yml b/tasks/configure-RedHat.yml index 8577461..6b71954 100644 --- a/tasks/configure-RedHat.yml +++ b/tasks/configure-RedHat.yml @@ -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 }}"