From be5f563f092beb44af0c570c02d9f1254767045d Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 28 Sep 2024 09:37:18 +0200 Subject: [PATCH] Reduce output when looping over zones --- tasks/main.yml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index f54e0fa..243e853 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,8 +26,10 @@ - name: Create dynamic DNS keys ansible.builtin.include_tasks: create_ddns_keys.yml - with_items: + loop: - "{{ bind9_zones_static + bind9_zones_dynamic }}" + loop_control: + label: "{{ item.name }}" when: bind9_generate_ddns_key | bool - name: Configure bind9 named.conf files @@ -37,7 +39,7 @@ owner: root group: "{{ bind9_group }}" mode: "0644" - with_items: + loop: - named.conf.local - named.conf.options notify: @@ -79,7 +81,7 @@ owner: root group: "{{ bind9_group }}" mode: "0644" - with_items: "{{ bind9_authoritative_includes }}" + loop: "{{ bind9_authoritative_includes }}" when: bind9_authoritative | default() notify: - Zone file change @@ -118,8 +120,10 @@ owner: "{{ bind9_user }}" group: "{{ bind9_group }}" mode: "0644" - with_items: + loop: - "{{ bind9_zones_static + bind9_zones_dynamic }}" + loop_control: + label: "{{ item.name }}" when: - bind9_authoritative | default() - item.type | default(bind9_zone_type) == 'master' @@ -132,8 +136,10 @@ owner: "{{ bind9_user }}" group: "{{ bind9_group }}" mode: "0600" - with_items: + loop: - "{{ bind9_zones_static + bind9_zones_dynamic }}" + loop_control: + label: "{{ item.name }}" when: - bind9_authoritative | default() - item.type | default(bind9_zone_type) == 'master' @@ -145,8 +151,10 @@ paths: "{{ bind9_keydir }}" patterns: "K{{ item.name }}.+008+*" register: bind9_reg_dnssec_keys_tmp - with_items: + loop: - "{{ bind9_zones_dynamic + bind9_zones_static }}" + loop_control: + label: "{{ item.name }}" when: - bind9_authoritative | default() - bind9_dnssec | default() or item.dnssec | default(bind9_dnssec_zones_default_enabled) @@ -317,7 +325,9 @@ group: "{{ bind9_group }}" mode: "0644" force: "{{ item.force_update | default('yes') }}" - with_items: "{{ bind9_zones_static }}" + loop: "{{ bind9_zones_static }}" + loop_control: + label: "{{ item.name }}" when: - bind9_authoritative | default() - item.type | default(bind9_zone_type) == 'master' @@ -332,9 +342,11 @@ register: bind9_reg_named_checkzone become: true become_user: "{{ bind9_user }}" - with_items: + loop: - "{{ bind9_zones_dynamic }}" - "{{ bind9_zones_static }}" + loop_control: + label: "{{ item.name }}" when: item.type | default(bind9_zone_type) == 'master' changed_when: False vars: