Robert Kaussow
6516293b2b
All checks were successful
continuous-integration/drone/push Build is passing
27 lines
907 B
YAML
27 lines
907 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
|
|
validate: /bin/bash -c 'nginx -t -c /dev/stdin <<< "events {worker_connections 10;} http { include %s; }"'
|
|
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
|