ansible/roles/nginx/tasks/main.yml

56 lines
1.4 KiB
YAML

---
- name: gather os specific variables
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- vars
- name: include os specific tasks
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
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:
- 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
ansible.builtin.include_tasks: vhost.yaml
loop: "{{ nginx_vhosts | dict2items }}"
- name: manage service
service:
name: "{{ nginx_service_name }}"
state: "{{ nginx_service_state }}"
enabled: "{{ nginx_service_enabled }}"