ansible-roles/apache/tasks/main.yml

151 lines
3 KiB
YAML
Raw Normal View History

2017-07-13 14:09:24 +02:00
---
- name: packages are installed (Debian 9 or later)
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:
- apache2
- libapache2-mpm-itk
- libapache2-mod-evasive
- apachetop
- libwww-perl
2017-07-13 14:09:24 +02:00
tags:
- apache
- packages
when: ansible_distribution_major_version | version_compare('9', '>=')
2017-07-13 14:09:24 +02:00
- name: packages are installed (jessie)
2017-07-13 14:09:24 +02:00
apt:
name: '{{ item }}'
state: present
with_items:
- apache2-mpm-itk
- libapache2-mod-evasive
2017-07-13 14:09:24 +02:00
- apachetop
- libwww-perl
tags:
- apache
- packages
when: ansible_distribution_release == "jessie"
2017-07-13 14:09:24 +02: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-10-27 15:01:06 +02:00
- ssl
- include
- negotiation
- alias
notify: reload apache
tags:
2017-03-03 12:22:34 +01:00
- apache
2016-10-11 15:46:35 +02:00
- name: Copy Apache defaults config file
2016-11-04 22:15:13 +01:00
copy:
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
mode: "0640"
force: yes
notify: reload apache
tags:
- apache
- name: Copy Apache custom config file
copy:
src: evolinux-custom.conf
2016-12-22 19:02:05 +01:00
dest: "/etc/apache2/conf-available/zzz-evolinux-custom.conf"
owner: root
group: root
mode: "0640"
2017-03-21 17:35:42 +01:00
force: no
notify: reload apache
2017-03-21 17:35:42 +01:00
tags:
- apache
- name: disable status.conf
file:
dest: /etc/apache2/mods-enabled/status.conf
state: absent
notify: reload apache
- 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"
with_items:
2017-03-03 12:22:34 +01:00
- z-evolinux-defaults.conf
- zzz-evolinux-custom.conf
notify: reload apache
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
- name: default vhost is installed
template:
src: evolinux-default.conf.j2
dest: /etc/apache2/sites-available/000-evolinux-default.conf
mode: "0640"
force: no
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
- 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
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
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
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
- include_role:
name: remount-usr
tags:
- apache
2017-10-07 11:55:02 +02:00
- name: "Install save_apache_status.sh"
copy:
src: save_apache_status.sh
dest: /usr/share/scripts/save_apache_status.sh
mode: "0755"
force: no
2017-08-12 18:51:28 +02:00
- include: log2mail.yml
when: apache_log2mail_include
2017-08-12 18:51:15 +02:00
- include: munin.yml
when: apache_munin_include