Deploy custom facts with nginx_vhosts

This commit is contained in:
Emilien Mantel
2016-11-29 14:32:27 +01:00
parent 4a3aed6974
commit 8caddedc68
5 changed files with 25 additions and 1 deletions

View File

@@ -22,3 +22,5 @@
file: dest="{{ item.dir }}" owner="{{ item.owner }}" mode="{{ item.mode }}" state=directory
with_items: "{{ nginx_dirs }}"
- name: FILE | Create ansible facts dir
file: path=/etc/ansible/facts.d state=directory

View File

@@ -61,7 +61,7 @@
file: path={{ nginx_etc_dir}}/sites-enabled/{{ item.filename | default(item.name if item.name is string else item.name[0]) }} state=absent
with_items: "{{ nginx_vhosts }}"
notify: ['reload nginx', 'restart nginx freebsd']
when: item.state is defined and item.state == 'disabled'
when: item.state is defined and item.state == 'disabled'
- name: FILE | Delete default vhost when explicitely defined
file: >
@@ -77,3 +77,14 @@
state=link
notify: ['reload nginx', 'restart nginx freebsd']
when: nginx_default_vhost is none
- name: TEMPLATE | Deploy facts
template:
src=etc/ansible/facts.d/nginx.fact.j2
dest=/etc/ansible/facts.d/nginx.fact
mode=0644
register: fact
- name: SETUP
action: setup
when: fact.changed