roles/nginx: Use template to configure nginx vhosts

Signed-off-by: Alan Orth <alan.orth@gmail.com>
This commit is contained in:
2014-08-27 20:03:34 +03:00
parent 75a705ac87
commit 5bbec6716c
3 changed files with 14 additions and 20 deletions

View File

@ -23,16 +23,18 @@
file: path=/etc/nginx/conf.d/default.conf state=absent
tags: nginx
# need to modularize so we can have different vhosts in different files (apples.com and bananas.com in separate config files)
- name: Configure nginx vhosts
template: src={{ item }} dest=/etc/nginx/conf.d/{{ inventory_hostname }}.conf mode=0644 owner=root group=root
with_first_found:
- "../templates/{{ inventory_hostname }}.conf.j2"
- "../templates/default.conf.j2"
template: src=vhost.conf.j2 dest={{ nginx_confd_path }}/{{ item.nginx_domain_name }}.conf mode=0644 owner=root group=root
with_items: nginx_vhosts
notify:
- reload nginx
tags: nginx
- name: Create vhost document roots
file: path={{ nginx_root_prefix }}/{{ item.nginx_domain_name }} state=directory mode=0755 owner=nginx group=nginx
with_items: nginx_vhosts
tags: nginx
- name: Configure munin vhost
copy: src=munin.conf dest=/etc/nginx/conf.d/munin.conf mode=0644 owner=root group=root
notify: