nginx: refactor role
This commit is contained in:
@ -44,6 +44,19 @@
|
||||
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 }}"
|
||||
@ -52,4 +65,4 @@
|
||||
service:
|
||||
name: "{{ nginx_service_name }}"
|
||||
state: "{{ nginx_service_state }}"
|
||||
enabled: "{{ nginx_service_enabled }}"
|
||||
enabled: "{{ nginx_service_enabled }}"
|
@ -3,11 +3,11 @@
|
||||
block:
|
||||
- name: create webroot
|
||||
file:
|
||||
path: "{{ vhost.root }}"
|
||||
path: "{{ server.root }}"
|
||||
state: directory
|
||||
loop: "{{ item.value }}"
|
||||
loop: "{{ item.value.server }}"
|
||||
loop_control:
|
||||
loop_var: vhost
|
||||
loop_var: server
|
||||
|
||||
- name: configure virtual host
|
||||
template:
|
||||
|
Reference in New Issue
Block a user