forked from ISTI-ansible-roles/ansible-roles
library/roles/apache: Change the playbook to install and enable the mpm_worker as default. Manage enabling/disabling the service.
This commit is contained in:
parent
8e104cec4a
commit
da0794ed73
|
@ -1,15 +1,26 @@
|
|||
---
|
||||
apache_service_enabled: True
|
||||
apache_user: www-data
|
||||
apache_group: '{{ apache_user }}'
|
||||
|
||||
# Possible choices: event, prefork (the old ones), worker (the threaded version), itm
|
||||
apache_mpm_mode: worker
|
||||
|
||||
apache_packages:
|
||||
- apache2
|
||||
- apache2-mpm-prefork
|
||||
- 'apache2-mpm-{{ apache_mpm_mode }}'
|
||||
- apache2-utils
|
||||
- libapache2-mod-xsendfile
|
||||
- unzip
|
||||
- zip
|
||||
|
||||
# Only one can be present at the same time. It needs to be listed as the last one
|
||||
apache_worker_modules:
|
||||
# - { name: 'mpm_itm', state: 'absent' }
|
||||
- { name: 'mpm_event', state: 'absent' }
|
||||
- { name: 'mpm_prefork', state: 'absent' }
|
||||
- { name: 'mpm_{{ apache_mpm_mode }}', state: 'present' }
|
||||
|
||||
apache_default_modules:
|
||||
- headers
|
||||
- rewrite
|
||||
|
|
|
@ -2,3 +2,6 @@
|
|||
- name: apache2 reload
|
||||
service: name=apache2 state=reloaded
|
||||
|
||||
- name: apache2 restart
|
||||
service: name=apache2 state=restarted
|
||||
|
||||
|
|
|
@ -2,13 +2,19 @@
|
|||
- name: Install the apache packages
|
||||
apt: pkg={{ item }} state=installed force=yes
|
||||
with_items: apache_packages
|
||||
tags: apache
|
||||
tags: [ 'apache', 'apache_main_packages' ]
|
||||
|
||||
- name: Load the required worker module
|
||||
apache2_module: name={{ item.name }} state={{ item.state }}
|
||||
with_items: apache_worker_modules
|
||||
notify: apache2 restart
|
||||
tags: [ 'apache', 'apache_modules', 'apache_workers_modules' ]
|
||||
|
||||
- name: Load the required modules
|
||||
apache2_module: name={{ item }} state=present
|
||||
with_items: apache_default_modules
|
||||
notify: apache2 reload
|
||||
tags: apache
|
||||
tags: [ 'apache', 'apache_modules' ]
|
||||
|
||||
- name: Remove the default virtualhost file
|
||||
file: dest=/etc/apache2/sites-enabled/{{ item }} state=absent
|
||||
|
@ -17,3 +23,13 @@
|
|||
- 000-default.conf
|
||||
notify: apache2 reload
|
||||
tags: apache
|
||||
|
||||
- name: Ensure that the apache service is enabled and started
|
||||
service: name=apache2 state=started enabled=yes
|
||||
when: apache_service_enabled
|
||||
tags: apache
|
||||
|
||||
- name: Ensure that the apache service is disabled and stopped if we do not want it running
|
||||
service: name=apache2 state=stopped enabled=no
|
||||
when: not apache_service_enabled
|
||||
tags: apache
|
||||
|
|
Loading…
Reference in New Issue