nginx: add vhost support to role
This commit is contained in:
@ -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 }}"
|
||||
|
20
roles/nginx/tasks/vhost.yaml
Normal file
20
roles/nginx/tasks/vhost.yaml
Normal 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 }}"
|
Reference in New Issue
Block a user