ansible/roles/apache-php/tasks/main.yml

52 lines
1.4 KiB
YAML
Raw Normal View History

#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: Install, configure, and start Apache
block:
- name: Install Apache packages
apt:
name: "{{ packages }}"
vars:
packages:
- apache2
- libapache2-mod-php7.2
- php7.2
- php7.2-gd
- php7.2-json
- php7.2-mysql
- php7.2-curl
- php7.2-mbstring
- php7.2-intl
- php7.2-xml
- php7.2-zip
- php7.2-cgi
- php7.2-cli
- name: Copy configuration
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
loop:
- { src: "php-apache2.ini", dest: "/etc/php/7.2/apache2/php.ini", mode: "0644" }
- { src: "php-cgi.ini", dest: "/etc/php/7.2/cgi/php.ini", mode: "0644" }
- name: Disable default website
file:
# This is a symlink so who cares
path: "/etc/apache2/sites-enabled/000-default.conf"
state: absent
- name: Enable modules
block:
- name: Enable rewrite
command: "/usr/sbin/a2enmod rewrite"
args:
creates: /etc/apache2/mods-enabled/rewrite.load
- name: Enable SSL
command: "/usr/sbin/a2enmod ssl"
args:
creates: /etc/apache2/mods-enabled/ssl.load
- name: Enable header modification
command: "/usr/sbin/a2enmod headers"
args:
creates: /etc/apache2/mods-enabled/headers.load
become: yes