Added support for enabling/disabled config snippets on Debian/Ubuntu.

This commit is contained in:
Dick Visser 2016-12-28 19:14:54 +01:00
parent 2ad0164cfe
commit 58fe5c23d4
3 changed files with 26 additions and 1 deletions

View file

@ -88,7 +88,12 @@ The default values for the `AllowOverride` and `Options` directives for the `doc
- ssl.load
apache_mods_disabled: []
(Debian/Ubuntu ONLY) Which Apache mods to enable or disable (these will be symlinked into the appropriate location). See the `mods-available` directory inside the apache configuration directory (`/etc/apache2/mods-available` by default) for all the available mods.
apache_conf_enabled:
- other-vhosts-access-log.conf
- charset.conf
apache_conf_disabled: []
(Debian/Ubuntu ONLY) Which Apache modules and configuration snippets to enable or disable (these will be symlinked into the appropriate location). See the `mods-available` and `conf-available` directories inside the Apache configuration directory (`/etc/apache2/mods-available` and `/etc/apache2/conf-available` by default) for all the available modules and configuration snippets.
apache_packages:
- [platform-specific]

View file

@ -46,6 +46,11 @@ apache_mods_enabled:
- ssl.load
apache_mods_disabled: []
apache_conf_enabled:
- other-vhosts-access-log.conf
- charset.conf
apache_conf_disabled: []
# Set initial apache state. Recommended values: `started` or `stopped`
apache_state: started

View file

@ -22,6 +22,21 @@
state: absent
with_items: "{{ apache_mods_disabled }}"
notify: restart apache
- name: Enable Apache configuration snippet.
file:
src: "{{ apache_server_root }}/conf-available/{{ item }}"
dest: "{{ apache_server_root }}/conf-enabled/{{ item }}"
state: link
with_items: "{{ apache_conf_enabled }}"
notify: restart apache
- name: Disable Apache configuration snippet.
file:
path: "{{ apache_server_root }}/conf-enabled/{{ item }}"
state: absent
with_items: "{{ apache_conf_disabled }}"
notify: restart apache
- name: Check whether certificates defined in vhosts exist.
stat: "path={{ item.certificate_file }}"