ansible-role-apache/tasks/main.yml

46 lines
1.3 KiB
YAML
Raw Normal View History

---
# Include variables and define needed variables.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
2017-04-03 16:46:27 +02:00
- name: Include variables for Amazon Linux.
include_vars: "AmazonLinux.yml"
when: ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA"
- name: Define apache_packages.
set_fact:
apache_packages: "{{ __apache_packages | list }}"
when: apache_packages is not defined
# Setup/install tasks.
- include_tasks: "setup-{{ ansible_os_family }}.yml"
# 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"
changed_when: false
check_mode: no
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
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
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
- name: Ensure Apache has selected state and enabled on boot.
2014-10-06 02:13:00 +02:00
service:
name: "{{ apache_service }}"
state: "{{ apache_state }}"
2014-10-06 02:13:00 +02:00
enabled: yes