2014-03-07 15:51:16 +01:00
|
|
|
---
|
2015-01-02 18:47:26 +01:00
|
|
|
# Variable setup.
|
|
|
|
- name: Include OS-specific variables.
|
|
|
|
include_vars: "{{ ansible_os_family }}.yml"
|
|
|
|
|
|
|
|
- name: Define nginx_user.
|
|
|
|
set_fact:
|
|
|
|
nginx_user: "{{ __nginx_user }}"
|
|
|
|
when: nginx_user is not defined
|
|
|
|
|
2015-02-21 06:15:01 +01:00
|
|
|
# Setup/install tasks.
|
2017-11-08 11:42:54 +01:00
|
|
|
- include_tasks: setup-RedHat.yml
|
2022-08-24 16:44:51 +02:00
|
|
|
when: ansible_os_family == 'RedHat' or ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux'
|
2014-07-30 21:09:00 +02:00
|
|
|
|
2017-11-08 11:42:54 +01:00
|
|
|
- include_tasks: setup-Ubuntu.yml
|
2016-02-08 17:52:09 +01:00
|
|
|
when: ansible_distribution == 'Ubuntu'
|
|
|
|
|
2017-11-08 11:42:54 +01:00
|
|
|
- include_tasks: setup-Debian.yml
|
2014-07-30 21:09:00 +02:00
|
|
|
when: ansible_os_family == 'Debian'
|
2014-03-07 15:51:16 +01:00
|
|
|
|
2017-11-08 11:42:54 +01:00
|
|
|
- include_tasks: setup-FreeBSD.yml
|
2016-04-22 21:29:39 +02:00
|
|
|
when: ansible_os_family == 'FreeBSD'
|
|
|
|
|
2017-11-08 11:42:54 +01:00
|
|
|
- include_tasks: setup-OpenBSD.yml
|
2017-02-01 19:21:57 +01:00
|
|
|
when: ansible_os_family == 'OpenBSD'
|
|
|
|
|
2017-11-08 11:42:54 +01:00
|
|
|
- include_tasks: setup-Archlinux.yml
|
2017-06-13 02:41:39 +02:00
|
|
|
when: ansible_os_family == 'Archlinux'
|
|
|
|
|
2015-12-28 16:57:11 +01:00
|
|
|
# Vhost configuration.
|
2017-11-08 11:42:54 +01:00
|
|
|
- import_tasks: vhosts.yml
|
2015-12-22 16:37:58 +01:00
|
|
|
|
2015-02-21 06:15:01 +01:00
|
|
|
# Nginx setup.
|
2014-05-03 05:18:10 +02:00
|
|
|
- name: Copy nginx configuration in place.
|
2015-01-23 17:57:06 +01:00
|
|
|
template:
|
2017-03-25 21:46:37 +01:00
|
|
|
src: "{{ nginx_conf_template }}"
|
2016-04-22 21:29:39 +02:00
|
|
|
dest: "{{ nginx_conf_file_path }}"
|
2015-01-23 17:57:06 +01:00
|
|
|
owner: root
|
2016-04-22 21:29:39 +02:00
|
|
|
group: "{{ root_group }}"
|
2015-01-23 17:57:06 +01:00
|
|
|
mode: 0644
|
2015-12-22 17:55:29 +01:00
|
|
|
notify:
|
2016-01-22 10:26:39 +01:00
|
|
|
- reload nginx
|
2014-05-03 05:18:10 +02:00
|
|
|
|
2019-06-06 18:24:51 +02:00
|
|
|
- name: Ensure nginx service is running as configured.
|
|
|
|
service:
|
|
|
|
name: nginx
|
|
|
|
state: "{{ nginx_service_state }}"
|
|
|
|
enabled: "{{ nginx_service_enabled }}"
|