26 lines
792 B
YAML
26 lines
792 B
YAML
|
---
|
||
|
- block:
|
||
|
- name: Add vhost configurations
|
||
|
template:
|
||
|
src: etc/nginx/sites-available/vhost.j2
|
||
|
dest: "/etc/nginx/sites-available/{{ item.file }}"
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: 0640
|
||
|
loop: "{{ nginx_vhosts_default + nginx_vhosts_extra }}"
|
||
|
loop_control:
|
||
|
label: "{{ item.file }}"
|
||
|
notify: __nginx_reload
|
||
|
|
||
|
- name: Enable vhosts
|
||
|
file:
|
||
|
src: "/etc/nginx/sites-available/{{ item.file }}"
|
||
|
dest: "/etc/nginx/sites-enabled/{{ item.file }}"
|
||
|
state: "{{ 'link' if item.enabled | default(True) | bool else 'absent' }}"
|
||
|
loop: "{{ nginx_vhosts_default + nginx_vhosts_extra }}"
|
||
|
loop_control:
|
||
|
label: "{{ item.file }}"
|
||
|
notify: __nginx_reload
|
||
|
become: True
|
||
|
become_user: root
|