From 3fdc16578cbed5622b9caea9474aceac82ddd167 Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Mon, 30 Nov 2015 14:41:35 +0100 Subject: [PATCH] Improve file deletions --- tasks/vhost.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tasks/vhost.yml b/tasks/vhost.yml index 4d494fa..3102000 100644 --- a/tasks/vhost.yml +++ b/tasks/vhost.yml @@ -44,8 +44,7 @@ # with_fileglob: "web/*" - name: FILE | Delete vhosts - file: dest=/etc/nginx/sites-enabled/{{ item.name if item.name is string else item.name[0] }} state=absent - file: dest=/etc/nginx/sites-available/{{ item.name if item.name is string else item.name[0] }} state=absent + file: path=/etc/nginx/sites-available/{{ item.name if item.name is string else item.name[0] }} state=absent with_items: nginx_vhosts notify: reload nginx when: item.delete is defined and item.delete @@ -63,10 +62,10 @@ (item.delete is not defined or not item.delete) - name: FILE | Disable vhosts - file: dest=/etc/nginx/sites-enabled/{{ item.name if item.name is string else item.name[0] }} state=absent + file: path=/etc/nginx/sites-enabled/{{ item.name if item.name is string else item.name[0] }} state=absent with_items: nginx_vhosts notify: reload nginx - when: item.enable is defined and not item.enable + when: (item.enable is defined and not item.enable) or (item.delete is defined and item.delete) #- name: FILE | Create ssl dir per vhost (if needed) # file: dest=/etc/nginx/ssl/{{ item.name }} owner=root mode=0750 state=directory