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
|
2020-07-12 09:54:04 -05:00
|
|
|
- name: Configure modules
|
2020-02-20 03:49:06 -06:00
|
|
|
block:
|
2020-07-12 09:54:04 -05:00
|
|
|
- name: Disable modules
|
|
|
|
command:
|
|
|
|
argv:
|
|
|
|
- "/usr/sbin/a2enmod"
|
|
|
|
- "{{ item }}"
|
|
|
|
removes: "/etc/apache2/mods-enabled/{{ item }}.load"
|
|
|
|
loop:
|
|
|
|
- mpm_event
|
|
|
|
notify: restart apache
|
|
|
|
- name: Enable modules
|
|
|
|
command:
|
|
|
|
argv:
|
|
|
|
- "/usr/sbin/a2enmod"
|
|
|
|
- "{{ item }}"
|
|
|
|
creates: "/etc/apache2/mods-enabled/{{ item }}.load"
|
|
|
|
loop:
|
|
|
|
- mpm_prefork
|
|
|
|
- rewrite
|
|
|
|
- ssl
|
|
|
|
- headers
|
|
|
|
notify: restart apache
|
2020-02-10 01:19:59 -06:00
|
|
|
become: yes
|