---
|
|
- include: service.yaml
|
|
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
|
|
vars:
|
|
service_name: apache2
|
|
service_packages:
|
|
- apache2
|
|
|
|
- name: disable apache2 default configuration
|
|
file: path=/etc/apache2/sites-enabled/000-default.conf state=absent
|
|
notify: restart apache2
|
|
|
|
- name: install apache2 libapache2-mod-php5
|
|
apt:
|
|
name: "{{ item }}"
|
|
state: present
|
|
update_cache: yes
|
|
cache_valid_time: 3600
|
|
with_items:
|
|
- libapache2-mod-php5
|
|
when: php | bool
|
|
notify:
|
|
- restart apache2
|
|
|
|
- name: add apache2 configurations
|
|
template:
|
|
src: ../../{{ parent_role_path }}/templates/{{ item }}.apache2.j2
|
|
dest: /etc/apache2/sites-available/{{ item }}
|
|
with_items: "{{ config_names }}"
|
|
|
|
- name: enable apache2 configurations
|
|
file:
|
|
src: "/etc/apache2/sites-available/{{ item }}"
|
|
dest: "/etc/apache2/sites-enabled/{{ item }}"
|
|
state: link
|
|
with_items: "{{ config_names }}"
|
|
notify: restart apache2
|
|
|
|
- block:
|
|
- name: enable apache userdir module
|
|
apache2_module: state=present name=userdir
|
|
notify: restart apache2
|
|
|
|
- name: create public_html in /etc/skel
|
|
file:
|
|
path: /etc/skel/public_html
|
|
state: directory
|
|
mode: 660
|
|
|
|
when: user_dir | bool
|