]> git.phdru.name Git - ansible.git/blobdiff - playbooks/debian/roles/dehydrated/tasks/main.yml
Refactor: Join tasks into blocks to factor out conditions
[ansible.git] / playbooks / debian / roles / dehydrated / tasks / main.yml
index 87ebe8f05bd0eb9cde2931e4028f9e37f54cf48f..3405ff37245b6acfdaac15093bcac97f724cc8c2 100644 (file)
@@ -5,30 +5,30 @@
   register: dehydrated
   changed_when: not dehydrated.stat.exists
 
-- name: Install git
-  local_action:
-    module: apt
-    autoclean: yes
-    autoremove: yes
-    install_recommends: no
-    name: git
-    purge: yes
-    state: latest
-    update_cache: yes
-  when: not dehydrated.stat.exists
+- block:
+    - name: Install git
+      become: true
+      local_action:
+        module: apt
+        autoclean: yes
+        autoremove: yes
+        install_recommends: no
+        name: git
+        purge: yes
+        state: latest
+        update_cache: yes
 
-- name: Prepare to clone dehydrated
-  local_action:
-    module: file
-    path: /usr/local/src/LetsEncrypt
-    state: directory
-  when: not dehydrated.stat.exists
+    - name: Prepare to clone dehydrated
+      local_action:
+        module: file
+        path: /usr/local/src/LetsEncrypt
+        state: directory
 
-- name: Clone dehydrated
-  local_action:
-    module: git
-    repo: https://github.com/lukas2511/dehydrated.git
-    dest: /usr/local/src/LetsEncrypt/dehydrated
+    - name: Clone dehydrated
+      local_action:
+        module: git
+        repo: https://github.com/lukas2511/dehydrated.git
+        dest: /usr/local/src/LetsEncrypt/dehydrated
   when: not dehydrated.stat.exists
 
 - name: Prepare the server to syncronize dehydrated