]> git.phdru.name Git - ansible.git/blobdiff - playbooks/debian/roles/named/tasks/main.yml
Fix(named): Fix conditions
[ansible.git] / playbooks / debian / roles / named / tasks / main.yml
index 193cace3a3ff81ca4ade2cdf0804b194a24b345f..b39eda30ceead641e07f1cfd5da7bd4f9e0645cb 100644 (file)
@@ -1,11 +1,12 @@
 - name: Check named.conf.options
-  shell: "grep -c '^\\s*allow-query' /etc/bind/named.conf.options || echo 0"
+  become: true
+  shell: "grep -c '^\\s*allow-query' /etc/bind/named.conf.options || :"
   register: named_conf
-  changed_when: named_conf.stdout == "0"
+  changed_when: named_conf.stdout in ('', "0")
 
 - debug:
     msg: "BIND has already been configured"
-  when: named_conf.stdout != "0"
+  when: named_conf.stdout not in ('', "0")
 
 - name: Install BIND
   become: true
@@ -17,7 +18,7 @@
     purge: yes
     state: latest
     update_cache: yes
-  when: named_conf.stdout == "0"
+  when: named_conf.stdout in ('', "0")
 
 - name: Configure BIND
   become: true
     owner: bind
     group: bind
     mode: '0600'
-  when: named_conf.stdout == "0"
+  when: named_conf.stdout in ('', "0")
 
 - name: Reload BIND
   become: true
   service:
     name: bind9
     state: reloaded
-  when: named_conf.stdout == "0"
+  when: named_conf.stdout in ('', "0")