]> git.phdru.name Git - ansible.git/blobdiff - playbooks/debian/roles/add-apache-vhost/tasks/main.yml
Feat: Use module `stat` instead of command `test`
[ansible.git] / playbooks / debian / roles / add-apache-vhost / tasks / main.yml
index 0133626c021d8b664b93446a6884de249833acd6..666cd77d7ce9c15a0d0fdee7cf880cba929bfb32 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.stats.exists
 
 - name: Run dehydrated for the vhost
   import_tasks: dehydrated.yml
-  when: vhost.rc != 0
+  when: not vhost_conf.stats.exists