-
Chris Croome authoredChris Croome authored
main.yml 1.96 KiB
---
- name: Apache packages installed
apt:
pkg:
- apache2
- apache2-utils
- lynx
state: latest
update_cache: true
register: apache_packages
- name: Apache suexec package installed
apt:
pkg:
- apache2-suexec-pristine
state: latest
update_cache: false
register: apache_suexec_suexec-pristine
when: ( apache_suexec is defined ) and ( apache_suexec is True )
- name: Apache conf disabled
command: "a2disconf {{ item }}"
args:
removes: /etc/apache2/conf-enabled/{{ item }}.conf
with_items:
- serve-cgi-bin
register: apache_conf
- name: Apache modules enabled
apache2_module:
name: "{{ item }}"
state: present
with_items:
- rewrite
- headers
- http2
- env
- dir
- mime
- ssl
register: apache_modules
- name: Custom Apache ssl.conf in place
copy:
src: files/ssl.conf
dest: /etc/apache2/mods-available/ssl.conf
register: apache_ssl
- name: Apache localhost directory in place
file:
path: /var/www/localhost
state: directory
- name: Apache localhost.conf in place
copy:
src: files/localhost.conf
dest: /etc/apache2/sites-available/localhost.conf
register: apache_localhost
- name: Apache localhost enabled
command: a2ensite localhost
args:
creates: /etc/apache2/sites-enabled/localhost.conf
- block:
- name: Apache configtest
command: apache2ctl configtest
register: apache2ctl_configtest