2020-02-10 01:19:59 -06:00
|
|
|
#!/usr/bin/ansible-playbook
|
|
|
|
# vim:ft=ansible:
|
|
|
|
---
|
2020-04-26 02:02:15 -05:00
|
|
|
- name: Install, configure, and start Apache and PHP
|
2020-02-10 01:19:59 -06:00
|
|
|
block:
|
2020-04-26 02:02:15 -05:00
|
|
|
- name: Install Apache and PHP packages
|
2020-02-10 01:19:59 -06:00
|
|
|
apt:
|
|
|
|
name: "{{ packages }}"
|
|
|
|
vars:
|
|
|
|
packages:
|
|
|
|
- apache2
|
2020-02-29 03:03:55 -06:00
|
|
|
- libapache2-mod-php
|
|
|
|
- php
|
|
|
|
- php-gd
|
|
|
|
- php-json
|
|
|
|
- php-mysql
|
|
|
|
- php-curl
|
|
|
|
- php-mbstring
|
|
|
|
- php-intl
|
|
|
|
- php-xml
|
|
|
|
- php-zip
|
|
|
|
- php-cgi
|
|
|
|
- php-cli
|
2020-04-26 02:02:15 -05:00
|
|
|
- name: Find PHP config directory
|
|
|
|
find:
|
|
|
|
paths: /etc/php
|
|
|
|
patterns: '*'
|
|
|
|
file_type: directory
|
|
|
|
register: phpdirs
|
|
|
|
- name: Debug
|
|
|
|
debug:
|
|
|
|
var: phpdirs.files.0.path
|
2020-02-10 01:19:59 -06:00
|
|
|
- name: Copy configuration
|
|
|
|
copy:
|
|
|
|
src: "{{ item.src }}"
|
2020-04-26 02:02:15 -05:00
|
|
|
dest: "{{ phpdirs.files.0.path }}/{{ item.dest }}"
|
2020-02-10 01:19:59 -06:00
|
|
|
mode: "{{ item.mode }}"
|
|
|
|
loop:
|
2020-04-26 02:02:15 -05:00
|
|
|
- { src: "php-apache2.ini", dest: "apache2/php.ini", mode: "0644" }
|
|
|
|
- { src: "php-cgi.ini", dest: "cgi/php.ini", mode: "0644" }
|
2020-02-10 01:19:59 -06:00
|
|
|
- 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
|
2020-02-20 03:49:06 -06:00
|
|
|
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
|
2020-02-10 01:19:59 -06:00
|
|
|
become: yes
|