2014-10-22 20:41:14 +02:00
|
|
|
---
|
|
|
|
- name: Configure Apache.
|
|
|
|
lineinfile:
|
|
|
|
dest: "{{ apache_server_root }}/ports.conf"
|
|
|
|
regexp: "{{ item.regexp }}"
|
|
|
|
line: "{{ item.line }}"
|
|
|
|
state: present
|
2016-02-29 06:32:02 +01:00
|
|
|
with_items: "{{ apache_ports_configuration_items }}"
|
2014-10-22 20:41:14 +02:00
|
|
|
notify: restart apache
|
|
|
|
|
|
|
|
- name: Enable Apache mods.
|
|
|
|
file:
|
|
|
|
src: "{{ apache_server_root }}/mods-available/{{ item }}"
|
|
|
|
dest: "{{ apache_server_root }}/mods-enabled/{{ item }}"
|
|
|
|
state: link
|
2016-02-29 06:32:02 +01:00
|
|
|
with_items: "{{ apache_mods_enabled }}"
|
2014-10-22 20:41:14 +02:00
|
|
|
notify: restart apache
|
|
|
|
|
2015-05-31 23:01:27 +02:00
|
|
|
- name: Disable Apache mods.
|
|
|
|
file:
|
|
|
|
path: "{{ apache_server_root }}/mods-enabled/{{ item }}"
|
|
|
|
state: absent
|
2016-02-29 06:32:02 +01:00
|
|
|
with_items: "{{ apache_mods_disabled }}"
|
2015-05-31 23:01:27 +02:00
|
|
|
notify: restart apache
|
|
|
|
|
2016-01-16 16:55:07 +01:00
|
|
|
- name: Check whether certificates defined in vhosts exist.
|
2016-02-29 06:32:02 +01:00
|
|
|
stat: "path={{ item.certificate_file }}"
|
2016-01-16 16:55:07 +01:00
|
|
|
register: apache_ssl_certificates
|
2016-02-29 06:32:02 +01:00
|
|
|
with_items: "{{ apache_vhosts_ssl }}"
|
2016-01-16 16:55:07 +01:00
|
|
|
|
2014-10-22 20:41:14 +02:00
|
|
|
- name: Add apache vhosts configuration.
|
|
|
|
template:
|
2016-04-25 15:56:30 +02:00
|
|
|
src: "vhosts.conf.j2"
|
2015-01-08 18:29:36 +01:00
|
|
|
dest: "{{ apache_conf_path }}/sites-available/{{ apache_vhosts_filename }}"
|
2014-10-22 20:41:14 +02:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart apache
|
|
|
|
when: apache_create_vhosts
|
|
|
|
|
|
|
|
- name: Add vhost symlink in sites-enabled.
|
|
|
|
file:
|
2015-01-08 18:29:36 +01:00
|
|
|
src: "{{ apache_conf_path }}/sites-available/{{ apache_vhosts_filename }}"
|
|
|
|
dest: "{{ apache_conf_path }}/sites-enabled/{{ apache_vhosts_filename }}"
|
2014-10-22 20:41:14 +02:00
|
|
|
state: link
|
2015-07-23 19:04:31 +02:00
|
|
|
notify: restart apache
|
2014-11-04 18:02:42 +01:00
|
|
|
when: apache_create_vhosts
|
2015-07-23 19:04:31 +02:00
|
|
|
|
|
|
|
- name: Remove default vhost in sites-enabled.
|
2015-01-28 13:54:09 +01:00
|
|
|
file:
|
|
|
|
path: "{{ apache_conf_path }}/sites-enabled/{{ apache_default_vhost_filename }}"
|
|
|
|
state: absent
|
2015-07-23 19:04:31 +02:00
|
|
|
notify: restart apache
|
2015-01-28 13:54:09 +01:00
|
|
|
when: apache_remove_default_vhost
|