40 lines
846 B
YAML
40 lines
846 B
YAML
---
|
|
- name: Install apache
|
|
become: true
|
|
apt:
|
|
name: apache2
|
|
state: present
|
|
update_cache: yes
|
|
notify: Start apache2 service
|
|
|
|
- name: Remove default html dir
|
|
become: true
|
|
file:
|
|
path: /var/www/html
|
|
state: absent
|
|
|
|
- name: Check if default vHost is enabled
|
|
stat:
|
|
path: /etc/apache2/sites-enabled/000-default.conf
|
|
register: enabled_default_vhost
|
|
|
|
- name: Disable default vHost
|
|
become: true
|
|
command: a2dissite 000-default.conf
|
|
when: enabled_default_vhost.stat.exists
|
|
notify: Reload apache2 service
|
|
|
|
- name: Remove default vHost conf files
|
|
become: true
|
|
file:
|
|
path: "/etc/apache2/sites-available/{{ item }}"
|
|
state: absent
|
|
with_items:
|
|
- 000-default.conf
|
|
- default-ssl.conf
|
|
|
|
- name: Create /var/www/empty for *:80 vHosts
|
|
become: true
|
|
file:
|
|
path: /var/www/empty
|
|
state: directory
|