]> git.phdru.name Git - ansible.git/blobdiff - playbooks/debian/roles/add-apache-vhost/tasks/main.yml
Fix conditions
[ansible.git] / playbooks / debian / roles / add-apache-vhost / tasks / main.yml
index 0133626c021d8b664b93446a6884de249833acd6..7a441497696804bca3a35bfa7c686869f9e7f190 100644 (file)
@@ -1,13 +1,12 @@
 - name: Check vhost
-  command: "test -L /etc/apache2/sites-enabled/{{ virtual_host }}.conf"
-  failed_when: false
-  register: vhost
-  changed_when: vhost.rc != 0
+  stat:
+    path: "/etc/apache2/sites-enabled/{{ virtual_host }}.conf"
+  register: vhost_conf
 
 - name: Add vhost
   import_tasks: add-vhost.yml
-  when: vhost.rc != 0
+  when: not vhost_conf.stat.exists
 
 - name: Run dehydrated for the vhost
   import_tasks: dehydrated.yml
-  when: vhost.rc != 0
+  when: not vhost_conf.stat.exists