xoxys.nginx/tasks/vhost.yml
Robert Kaussow fe75cf9ee4
Some checks failed
continuous-integration/drone/push Build is failing
copy tls certs before creating vhosts to avoid validation errors
2020-02-23 16:49:35 +01:00

29 lines
909 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