ansible/roles/nginx/tasks/main.yml

53 lines
1.3 KiB
YAML
Raw Normal View History

2019-10-27 23:32:25 +00:00
---
2020-09-21 03:44:45 +00:00
- 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
2019-10-27 23:32:25 +00:00
- 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 }}"
2020-09-21 03:44:45 +00:00
- name: configure nginx
template:
2020-09-21 03:44:45 +00:00
src: nginx.conf.j2
dest: "{{ nginx_etc_path }}/nginx.conf"
owner: root
group: root
mode: 0644
notify: reload nginx
2019-10-27 23:32:25 +00:00
- name: manage service
service:
name: "{{ nginx_service_name }}"
state: "{{ nginx_service_state }}"
enabled: "{{ nginx_service_enabled }}"