X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Froles%2Fnamed%2Ftasks%2Fmain.yml;h=b39eda30ceead641e07f1cfd5da7bd4f9e0645cb;hb=a1b08d5935de21449861924a509622a33325fcbf;hp=ded1b35ef5581a2e68648070684ffcd2887c0a33;hpb=f85d72f8ccbb74da7626fd2381878f7816d73e63;p=ansible.git diff --git a/playbooks/debian/roles/named/tasks/main.yml b/playbooks/debian/roles/named/tasks/main.yml index ded1b35..b39eda3 100644 --- a/playbooks/debian/roles/named/tasks/main.yml +++ b/playbooks/debian/roles/named/tasks/main.yml @@ -1,11 +1,12 @@ -- name: Check locales - shell: "grep -c '^[ \\t]\\+allow-query' /etc/bind/named.conf.options || :" +- name: Check named.conf.options + 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 @@ -27,11 +28,11 @@ 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")