61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
#!/usr/bin/ansible-playbook
|
|
# vim:ft=ansible:
|
|
---
|
|
- name: Install, configure, and start Apache and PHP
|
|
block:
|
|
- name: Install Apache and PHP packages
|
|
apt:
|
|
name: "{{ packages }}"
|
|
vars:
|
|
packages:
|
|
- apache2
|
|
- libapache2-mod-php
|
|
- php
|
|
- php-gd
|
|
- php-json
|
|
- php-mysql
|
|
- php-curl
|
|
- php-mbstring
|
|
- php-intl
|
|
- php-xml
|
|
- php-zip
|
|
- php-cgi
|
|
- php-cli
|
|
- name: Find PHP config directory
|
|
find:
|
|
paths: /etc/php
|
|
patterns: '*'
|
|
file_type: directory
|
|
register: phpdirs
|
|
- name: Debug
|
|
debug:
|
|
var: phpdirs.files.0.path
|
|
- name: Copy configuration
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ phpdirs.files.0.path }}/{{ item.dest }}"
|
|
mode: "{{ item.mode }}"
|
|
loop:
|
|
- { src: "php-apache2.ini", dest: "apache2/php.ini", mode: "0644" }
|
|
- { src: "php-cgi.ini", dest: "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
|