]> git.phdru.name Git - ansible.git/blobdiff - playbooks/debian/roles/add-apache-vhost/tasks/main.yml
Refactor: Join tasks into blocks to factor out conditions
[ansible.git] / playbooks / debian / roles / add-apache-vhost / tasks / main.yml
index 7a441497696804bca3a35bfa7c686869f9e7f190..511a67676a96f1019f5d7cff98fe096173c05655 100644 (file)
@@ -2,11 +2,11 @@
   stat:
     path: "/etc/apache2/sites-enabled/{{ virtual_host }}.conf"
   register: vhost_conf
+  changed_when: not vhost_conf.stat.exists
 
-- name: Add vhost
-  import_tasks: add-vhost.yml
-  when: not vhost_conf.stat.exists
-
-- name: Run dehydrated for the vhost
-  import_tasks: dehydrated.yml
+- block:
+    - name: Add vhost
+      import_tasks: add-vhost.yml
+    - name: Run dehydrated for the vhost
+      import_tasks: dehydrated.yml
   when: not vhost_conf.stat.exists