nginx: add vhost support to role

This commit is contained in:
2022-08-30 06:54:38 -05:00
parent 29c2b9b4df
commit 30247b26c3
5 changed files with 70 additions and 2 deletions

View File

@ -45,6 +45,10 @@
mode: 0644
notify: reload nginx
- name: configure virtual hosts
include_tasks: vhost.yaml
loop: "{{ nginx_vhosts | dict2items }}"
- name: manage service
service:
name: "{{ nginx_service_name }}"

View File

@ -0,0 +1,20 @@
---
- name: configure virtual hosts
block:
- name: create webroot
file:
path: "{{ vhost.root }}"
state: directory
loop: "{{ item.value }}"
loop_control:
loop_var: vhost
- name: configure virtual host
template:
src: vhost.conf.j2
dest: "{{ nginx_conf_d_path }}/{{ item.key }}.conf"
owner: root
group: root
mode: 0444
notify: reload nginx
loop: "{{ nginx_vhosts | dict2items }}"