ansible-role-nginx/tasks/main.yml

49 lines
1.2 KiB
YAML
Raw Normal View History

2014-03-07 15:51:16 +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
# Setup/install tasks.
- 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
- include_tasks: setup-Ubuntu.yml
when: ansible_distribution == 'Ubuntu'
- 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
- include_tasks: setup-FreeBSD.yml
2016-04-22 21:29:39 +02:00
when: ansible_os_family == 'FreeBSD'
- include_tasks: setup-OpenBSD.yml
2017-02-01 19:21:57 +01:00
when: ansible_os_family == 'OpenBSD'
- include_tasks: setup-Archlinux.yml
2017-06-13 02:41:39 +02:00
when: ansible_os_family == 'Archlinux'
# Vhost configuration.
- import_tasks: vhosts.yml
# Nginx setup.
- name: Copy nginx configuration in place.
2015-01-23 17:57:06 +01:00
template:
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
notify:
- reload nginx
- name: Ensure nginx service is running as configured.
service:
name: nginx
state: "{{ nginx_service_state }}"
enabled: "{{ nginx_service_enabled }}"