2017-07-13 14:09:24 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Main packages are installed
|
2016-10-11 03:58:51 +02:00
|
|
|
apt:
|
|
|
|
name: '{{ item }}'
|
2016-11-04 22:15:13 +01:00
|
|
|
state: present
|
2016-10-11 03:58:51 +02:00
|
|
|
with_items:
|
2017-03-29 17:45:57 +02:00
|
|
|
- apache2
|
2017-07-13 14:09:24 +02:00
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
- packages
|
|
|
|
|
|
|
|
- name: Install packages for Jessie
|
|
|
|
apt:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: present
|
|
|
|
with_items:
|
2017-07-03 18:22:24 +02:00
|
|
|
- apache2-mpm-prefork
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
2017-03-03 12:22:34 +01:00
|
|
|
- apache
|
2017-07-13 14:09:24 +02:00
|
|
|
- packages
|
|
|
|
when: ansible_distribution_release == "jessie"
|
2016-10-11 03:58:51 +02:00
|
|
|
|
2017-07-03 18:22:24 +02:00
|
|
|
- name: manually disable mpm_event
|
|
|
|
command: a2dismod mpm_event
|
|
|
|
register: cmd_disable_event
|
|
|
|
changed_when: "'Module mpm_event already disabled' not in cmd_disable_event.stdout"
|
2017-07-13 14:09:24 +02:00
|
|
|
notify: restart apache
|
|
|
|
tags:
|
|
|
|
- apache
|
2017-07-03 18:22:24 +02:00
|
|
|
|
|
|
|
- name: manually enable mpm_prefork
|
|
|
|
command: a2enmod mpm_prefork
|
|
|
|
register: cmd_disable_prefork
|
|
|
|
changed_when: "'Module mpm_prefork already enabled' not in cmd_disable_prefork.stdout"
|
2017-07-13 14:09:24 +02:00
|
|
|
notify: restart apache
|
|
|
|
tags:
|
|
|
|
- apache
|
2017-07-03 18:22:24 +02:00
|
|
|
|
|
|
|
# With Ansible 2.2 the module check the config for conflicts
|
|
|
|
# With 2.3 it can be disabled.
|
|
|
|
# https://docs.ansible.com/ansible/apache2_module_module.html
|
|
|
|
# - name: mpm_event modules is disabled
|
|
|
|
# apache2_module:
|
|
|
|
# name: '{{ item }}'
|
|
|
|
# state: absent
|
|
|
|
# with_items:
|
|
|
|
# - mpm_event
|
|
|
|
# tags:
|
|
|
|
# - apache
|
|
|
|
|
2017-07-13 14:09:24 +02:00
|
|
|
- name: Additional packages are installed
|
|
|
|
apt:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- apg
|
|
|
|
- apachetop
|
|
|
|
- libwww-perl
|
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
- packages
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: basic modules are enabled
|
2016-11-04 22:15:13 +01:00
|
|
|
apache2_module:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: present
|
|
|
|
with_items:
|
2017-03-03 12:22:34 +01:00
|
|
|
- rewrite
|
|
|
|
- expires
|
|
|
|
- headers
|
|
|
|
- cgi
|
2017-03-21 17:35:42 +01:00
|
|
|
- ssl
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
2017-03-03 12:22:34 +01:00
|
|
|
- apache
|
2016-10-11 15:46:35 +02:00
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: Copy Apache defaults config file
|
2016-11-04 22:15:13 +01:00
|
|
|
copy:
|
2016-11-07 14:00:57 +01:00
|
|
|
src: evolinux-defaults.conf
|
2016-12-22 19:02:05 +01:00
|
|
|
dest: "/etc/apache2/conf-available/z-evolinux-defaults.conf"
|
2016-11-04 22:15:13 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
2017-03-03 12:23:08 +01:00
|
|
|
mode: "0644"
|
2016-11-07 14:00:57 +01:00
|
|
|
force: yes
|
|
|
|
tags:
|
2017-03-03 12:22:34 +01:00
|
|
|
- apache
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: Copy Apache custom config file
|
2017-03-03 12:21:17 +01:00
|
|
|
copy:
|
|
|
|
src: evolinux-custom.conf
|
2016-12-22 19:02:05 +01:00
|
|
|
dest: "/etc/apache2/conf-available/zzz-evolinux-custom.conf"
|
2016-11-07 14:00:57 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
2017-03-03 12:23:08 +01:00
|
|
|
mode: "0644"
|
2016-11-07 14:00:57 +01:00
|
|
|
force: no
|
|
|
|
tags:
|
2017-03-03 12:22:34 +01:00
|
|
|
- apache
|
2016-10-11 03:58:51 +02:00
|
|
|
|
2017-03-21 17:35:42 +01:00
|
|
|
- name: Copy Apache SSL (strong security) config file
|
|
|
|
copy:
|
|
|
|
src: evolinux-ssl.conf
|
|
|
|
dest: "/etc/apache2/conf-available/evolinux-ssl.conf"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|
|
|
|
force: no
|
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: Ensure Apache config files are enabled
|
|
|
|
command: "a2enconf {{ item }}"
|
2016-11-04 22:15:13 +01:00
|
|
|
register: command_result
|
|
|
|
changed_when: "'Enabling' in command_result.stderr"
|
2016-11-07 14:00:57 +01:00
|
|
|
with_items:
|
2017-03-03 12:22:34 +01:00
|
|
|
- z-evolinux-defaults.conf
|
|
|
|
- zzz-evolinux-custom.conf
|
2017-03-21 17:35:42 +01:00
|
|
|
- evolinux-ssl.conf
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
2017-03-03 12:22:34 +01:00
|
|
|
- apache
|
2016-10-11 03:58:51 +02:00
|
|
|
|
2017-07-13 14:09:24 +02:00
|
|
|
- include: auth.yml
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2017-07-05 18:22:00 +02:00
|
|
|
- name: default vhost is installed
|
|
|
|
template:
|
|
|
|
src: evolinux-default.conf.j2
|
|
|
|
dest: /etc/apache2/sites-available/000-evolinux-default.conf
|
|
|
|
mode: "0640"
|
|
|
|
# force: yes
|
|
|
|
notify: reload apache
|
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
|
|
|
|
- name: default vhost is enabled
|
|
|
|
file:
|
|
|
|
src: /etc/apache2/sites-available/000-evolinux-default.conf
|
|
|
|
dest: /etc/apache2/sites-enabled/000-default.conf
|
|
|
|
state: link
|
|
|
|
force: yes
|
|
|
|
notify: reload apache
|
|
|
|
when: apache_evolinux_default_enabled
|
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: is umask already present?
|
|
|
|
command: "grep -E '^umask ' /etc/apache2/envvars"
|
|
|
|
failed_when: False
|
|
|
|
changed_when: False
|
|
|
|
register: envvar_grep_umask
|
2017-03-24 14:15:09 +01:00
|
|
|
check_mode: no
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
2017-03-03 12:22:34 +01:00
|
|
|
- apache
|
2016-10-11 15:46:35 +02:00
|
|
|
|
2016-11-04 22:15:13 +01:00
|
|
|
- name: Add a mark in envvars for umask
|
2016-10-11 15:46:35 +02:00
|
|
|
blockinfile:
|
|
|
|
dest: /etc/apache2/envvars
|
2016-11-07 14:00:57 +01:00
|
|
|
marker: "## {mark} ANSIBLE MANAGED BLOCK"
|
2016-10-11 15:46:35 +02:00
|
|
|
block: |
|
|
|
|
## Set umask for writing by Apache user.
|
|
|
|
## Set rights on files and directories written by Apache
|
2016-11-07 14:00:57 +01:00
|
|
|
umask 007
|
|
|
|
when: envvar_grep_umask.rc != 0
|
|
|
|
tags:
|
2017-03-03 12:22:34 +01:00
|
|
|
- apache
|
2017-07-13 14:09:24 +02:00
|
|
|
|
|
|
|
- name: Stat /default index
|
|
|
|
stat:
|
|
|
|
path: /var/www/index.html
|
|
|
|
register: _default_index
|
|
|
|
check_mode: no
|
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
|
|
|
|
- include: phpmyadmin.yml
|
|
|
|
when: _default_index.stat.exists
|
|
|
|
|
|
|
|
|
|
|
|
# - block:
|
|
|
|
# - name: generate random string for serverstatus suffix
|
|
|
|
# command: "apg -a 1 -M N -n 1"
|
|
|
|
# changed_when: False
|
|
|
|
# register: _random_serverstatus_suffix
|
|
|
|
#
|
|
|
|
# - name: overwrite apache_serverstatus_suffix
|
|
|
|
# set_fact:
|
|
|
|
# apache_serverstatus_suffix: "{{ _random_serverstatus_suffix.stdout }}"
|
|
|
|
# when: apache_serverstatus_suffix == ""
|
|
|
|
#
|
|
|
|
# - name: replace server-status suffix in default site index
|
|
|
|
# replace:
|
|
|
|
# dest: /var/www/index.html
|
|
|
|
# regexp: '__SERVERSTATUS_SUFFIX__'
|
|
|
|
# replace: "{{ apache_serverstatus_suffix }}"
|