]> git.phdru.name Git - ansible.git/blobdiff - playbooks/debian/roles/named/tasks/main.yml
Refactor: Join tasks into blocks to factor out conditions
[ansible.git] / playbooks / debian / roles / named / tasks / main.yml
index b39eda30ceead641e07f1cfd5da7bd4f9e0645cb..8c6b7d0f9e6048c1cb69f5ac2d3e7a5ce5aab59d 100644 (file)
@@ -8,31 +8,30 @@
     msg: "BIND has already been configured"
   when: named_conf.stdout not in ('', "0")
 
-- name: Install BIND
-  become: true
-  apt:
-    autoclean: yes
-    autoremove: yes
-    install_recommends: no
-    name: bind9
-    purge: yes
-    state: latest
-    update_cache: yes
-  when: named_conf.stdout in ('', "0")
+- block:
+    - name: Install BIND
+      become: true
+      apt:
+        autoclean: yes
+        autoremove: yes
+        install_recommends: no
+        name: bind9
+        purge: yes
+        state: latest
+        update_cache: yes
 
-- name: Configure BIND
-  become: true
-  copy:
-    src: named.conf.options
-    dest: /etc/bind/named.conf.options
-    owner: bind
-    group: bind
-    mode: '0600'
-  when: named_conf.stdout in ('', "0")
+    - name: Configure BIND
+      become: true
+      copy:
+        src: named.conf.options
+        dest: /etc/bind/named.conf.options
+        owner: bind
+        group: bind
+        mode: '0600'
 
-- name: Reload BIND
-  become: true
-  service:
-    name: bind9
-    state: reloaded
+    - name: Reload BIND
+      become: true
+      service:
+        name: bind9
+        state: reloaded
   when: named_conf.stdout in ('', "0")