ansible/roles/nginx/tasks/main.yml

57 lines
1.4 KiB
YAML

---
- name: gather os specific variables
include_vars: "{{ lookup('first_found', possible_files) }}"
vars:
possible_files:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- vars
- name: include os specific tasks
include_tasks: "{{ lookup('first_found', possible_files) }}"
vars:
possible_files:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- tasks
- name: install passlib
package:
name: "{{ item }}"
state: present
loop:
- python-passlib
- python3-passlib
- name: install package
package:
name: "{{ nginx_package_name }}"
state: "{{ nginx_package_state }}"
- name: configure nginx
template:
src: nginx.conf.j2
dest: "{{ nginx_etc_path }}/nginx.conf"
owner: root
group: root
mode: 0644
notify: reload nginx
- name: configure virtual hosts
include_tasks: vhost.yaml
loop: "{{ nginx_vhosts | dict2items }}"
- name: manage service
service:
name: "{{ nginx_service_name }}"
state: "{{ nginx_service_state }}"
enabled: "{{ nginx_service_enabled }}"