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
|
|
|
|
2017-04-03 16:46:27 +02:00
|
|
|
- name: Include variables for Amazon Linux.
|
2017-04-03 11:42:39 +02:00
|
|
|
include_vars: "AmazonLinux.yml"
|
|
|
|
when: ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA"
|
|
|
|
|
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.
|
2018-01-10 11:49:32 +01:00
|
|
|
- include_tasks: "setup-{{ ansible_os_family }}.yml"
|
2015-12-29 22:03:26 +01:00
|
|
|
|
2014-10-22 20:41:14 +02:00
|
|
|
# Figure out what version of Apache is installed.
|
|
|
|
- name: Get installed version of Apache.
|
2018-09-26 04:36:20 +02:00
|
|
|
command: "{{ apache_daemon_path }}{{ apache_daemon }} -v"
|
2014-10-22 20:41:14 +02:00
|
|
|
changed_when: false
|
2017-04-12 17:39:53 +02:00
|
|
|
check_mode: no
|
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] }}"
|
|
|
|
|
2018-09-26 04:36:20 +02:00
|
|
|
- name: Include Apache 2.2 variables.
|
|
|
|
include_vars: apache-22.yml
|
2014-10-22 20:41:14 +02:00
|
|
|
when: "apache_version.split('.')[1] == '2'"
|
|
|
|
|
2018-09-26 04:36:20 +02:00
|
|
|
- name: Include Apache 2.4 variables.
|
|
|
|
include_vars: apache-24.yml
|
2014-10-22 20:41:14 +02:00
|
|
|
when: "apache_version.split('.')[1] == '4'"
|
|
|
|
|
|
|
|
# Configure Apache.
|
2018-09-26 04:36:20 +02:00
|
|
|
- name: Configure Apache.
|
|
|
|
include_tasks: "configure-{{ ansible_os_family }}.yml"
|
2016-01-14 10:35:04 +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
|