68 lines
1.7 KiB
YAML
68 lines
1.7 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 htpasswd files
|
|
ansible.builtin.copy:
|
|
dest: "{{ nginx_etc_path }}/{{ item.key }}.htpasswd"
|
|
owner: root
|
|
group: nginx
|
|
mode: 0640
|
|
content: |
|
|
{% for u, h in item.value.items() %}
|
|
{{ u }}:{{ h }}
|
|
{% endfor %}
|
|
loop: "{{ nginx_htpasswd_files | dict2items }}"
|
|
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 }}" |