2014-02-28 23:23:24 +01:00
|
|
|
---
|
2014-10-22 20:41:14 +02:00
|
|
|
# Include variables and define needed variables.
|
2014-04-22 14:34:37 +02:00
|
|
|
- name: Include OS-specific variables.
|
|
|
|
include_vars: "{{ ansible_os_family }}.yml"
|
2014-10-05 15:02:17 +02:00
|
|
|
|
|
|
|
- name: Define apache_packages.
|
|
|
|
set_fact:
|
|
|
|
apache_packages: "{{ __apache_packages | list }}"
|
|
|
|
when: apache_packages is not defined
|
2014-02-28 23:23:24 +01:00
|
|
|
|
2014-10-22 20:41:14 +02:00
|
|
|
# Setup/install tasks.
|
2014-04-22 14:34:37 +02:00
|
|
|
- include: setup-RedHat.yml
|
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
- include: setup-Debian.yml
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
2014-10-22 20:41:14 +02:00
|
|
|
# Figure out what version of Apache is installed.
|
|
|
|
- name: Get installed version of Apache.
|
2015-07-23 18:58:03 +02:00
|
|
|
shell: "{{ apache_daemon_path }}{{ apache_daemon }} -v"
|
2014-10-22 20:41:14 +02:00
|
|
|
changed_when: false
|
2015-01-10 06:46:28 +01:00
|
|
|
always_run: yes
|
2014-10-22 20:41:14 +02:00
|
|
|
register: _apache_version
|
|
|
|
|
|
|
|
- name: Create apache_version variable.
|
|
|
|
set_fact:
|
|
|
|
apache_version: "{{ _apache_version.stdout.split()[2].split('/')[1] }}"
|
|
|
|
|
|
|
|
- include_vars: apache-22.yml
|
|
|
|
when: "apache_version.split('.')[1] == '2'"
|
|
|
|
|
|
|
|
- include_vars: apache-24.yml
|
|
|
|
when: "apache_version.split('.')[1] == '4'"
|
|
|
|
|
|
|
|
# Configure Apache.
|
|
|
|
- include: configure-RedHat.yml
|
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
- include: configure-Debian.yml
|
|
|
|
when: ansible_os_family == 'Debian'
|
2014-02-28 23:23:24 +01:00
|
|
|
|
2015-09-24 11:16:52 +02:00
|
|
|
- name: Ensure Apache has selected state and enabled on boot.
|
2014-10-06 02:13:00 +02:00
|
|
|
service:
|
2015-12-29 21:57:25 +01:00
|
|
|
name: "{{ apache_service }}"
|
2015-09-24 11:16:52 +02:00
|
|
|
state: "{{ apache_state }}"
|
2014-10-06 02:13:00 +02:00
|
|
|
enabled: yes
|