ansible-roles/packweb-apache/tasks/main.yml
Mathieu Trossevin 7c632352a0
Replace the include module with include_tasks or import_tasks
The behaviour of the `include` module is badly defined (it try to choose
between statically importing the tasks and dynamically including them)
and can cause problems depending on any number of constraints (mostly if
it choose the wrong behaviour).

Replace it with the `import_tasks` (always statically import tasks) unless
the `include` is in a loop in which case we replace it with
`include_tasks` (always dynamically include tasks).
2023-01-03 14:43:42 +01:00

105 lines
2.5 KiB
YAML

---
- name: Dependencies are satisfied
import_tasks: dependencies.yml
- fail:
msg: only compatible with Debian >= 8
when:
- ansible_distribution != "Debian" or ansible_distribution_major_version is version('8', '<')
- name: Additional packages are installed
apt:
name:
- zip
- unzip
state: present
- name: install info.php
copy:
src: info.php
dest: /var/www/info.php
mode: "0644"
- name: enable info.php link in default site index
lineinfile:
dest: /var/www/index.html
line: ' <li><a href="/info.php">Infos PHP</a></li>'
regexp: "Infos PHP"
- name: install opcache.php
copy:
src: opcache.php
dest: /var/www/opcache.php
mode: "0644"
- name: enable opcache.php link in default site index
lineinfile:
dest: /var/www/index.html
line: ' <li><a href="/opcache.php">Infos OpCache PHP</a></li>'
regexp: "Infos OpCache PHP"
- name: Add elements to user account template
file:
path: "/etc/skel/{{ item.path }}"
state: "{{ item.state }}"
mode: "{{ item.mode }}"
loop:
- { path: log, mode: "0750", state: directory }
- { path: awstats, mode: "0750", state: directory }
- { path: www, mode: "0750", state: directory }
- name: Apache log file (templates) are present
command: "touch /etc/skel/log/{{ item }}"
args:
creates: "/etc/skel/log/{{ item }}"
loop:
- access.log
- error.log
- name: Apache log file (templates) have the proper permissions
file:
dest: "/etc/skel/log/{{ item }}"
mode: "0644"
loop:
- access.log
- error.log
- name: "Install userlogrotate (jessie)"
copy:
src: userlogrotate_jessie
dest: /etc/cron.weekly/userlogrotate
mode: "0755"
when: ansible_distribution_release == "jessie"
- name: "Install userlogrotate (Debian 9 or later)"
copy:
src: userlogrotate
dest: /etc/cron.weekly/userlogrotate
mode: "0755"
when: ansible_distribution_major_version is version('9', '>=')
- name: Force DIR_MODE to 0750 in /etc/adduser.conf
lineinfile:
dest: /etc/adduser.conf
regexp: '^DIR_MODE='
line: 'DIR_MODE=0750'
- import_tasks: apache.yml
- import_tasks: phpmyadmin.yml
- import_tasks: awstats.yml
- import_tasks: fhs_retrictions.yml
when: packweb_fhs_retrictions | bool
- name: Periodically cache ftp directory sizes for ftpadmin.sh
cron:
name: "ProFTPd directory size caching"
special_time: daily
job: "/usr/share/scripts/evoadmin/stats.sh"
- import_tasks: multiphp.yml
when: packweb_multiphp_versions | length > 0