Refactor caching-nameserver.yml for consistency and clarity in variable naming

This commit is contained in:
2026-07-21 00:22:39 +02:00
parent ee5819c82c
commit 03951153c1
+11 -12
View File
@@ -1,4 +1,3 @@
--- ---
# --- # ---
# Install 'bind' apt based OS # Install 'bind' apt based OS
@@ -7,7 +6,7 @@
- name: (caching-nameserver.yml) update - name: (caching-nameserver.yml) update
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
cache_valid_time: "{{ 0 if apt_config_updated is defined and apt_config_updated.changed else apt_update_cache_valid_time }}" cache_valid_time: "{{ 0 if common_apt_config_updated is defined and common_apt_config_updated.changed else apt_update_cache_valid_time }}"
when: when:
- ansible_facts["distribution"] == "Debian" - ansible_facts["distribution"] == "Debian"
- apt_update|bool - apt_update|bool
@@ -16,9 +15,9 @@
- name: (caching-nameserver.yml) Configure any half-installed packages 'dpkg --configure -a' - name: (caching-nameserver.yml) Configure any half-installed packages 'dpkg --configure -a'
ansible.builtin.command: dpkg --configure -a ansible.builtin.command: dpkg --configure -a
register: _dpkg_configure register: common_dpkg_configure
changed_when: (_dpkg_configure.stdout | default('')) | length > 0 changed_when: (common_dpkg_configure.stdout | default('')) | length > 0
failed_when: _dpkg_configure.rc != 0 failed_when: common_dpkg_configure.rc != 0
when: when:
- ansible_facts["distribution"] == "Debian" - ansible_facts["distribution"] == "Debian"
- apt_update|bool - apt_update|bool
@@ -42,7 +41,7 @@
state: present state: present
when: when:
- ansible_facts["distribution"] == "Debian" - ansible_facts["distribution"] == "Debian"
- install_bind_packages|bool == true - install_bind_packages|bool
tags: tags:
- apt-caching-nameserver - apt-caching-nameserver
@@ -53,9 +52,9 @@
- name: (yum.yml) Install system updates for centos systems - name: (yum.yml) Install system updates for centos systems
ansible.builtin.dnf: ansible.builtin.dnf:
name: "*" name: "*"
state: latest state: present
update_cache: true update_cache: true
#cache_valid_time: 3600 # cache_valid_time: 3600
when: when:
- ansible_facts.os_family == "RedHat" - ansible_facts.os_family == "RedHat"
- ansible_facts["distribution"] == "CentOS" - ansible_facts["distribution"] == "CentOS"
@@ -94,7 +93,7 @@
owner: root owner: root
group: bind group: bind
mode: "0644" mode: "0644"
#validate: visudo -cf %s # validate: visudo -cf %s
notify: Reload bind9 notify: Reload bind9
tags: tags:
- apt-caching-nameserver - apt-caching-nameserver
@@ -110,7 +109,7 @@
- name: Check if file '/etc/bind/named.conf.options' exists - name: Check if file '/etc/bind/named.conf.options' exists
ansible.builtin.stat: ansible.builtin.stat:
path: /etc/bind/named.conf.options path: /etc/bind/named.conf.options
register: file_named_conf_options register: common_file_named_conf_options
- name: (caching-nameserver.yml) update named.conf.options configuration file (gateway server) - name: (caching-nameserver.yml) update named.conf.options configuration file (gateway server)
ansible.builtin.template: ansible.builtin.template:
@@ -120,7 +119,7 @@
owner: root owner: root
group: bind group: bind
mode: "0644" mode: "0644"
#validate: visudo -cf %s # validate: visudo -cf %s
notify: Reload bind9 notify: Reload bind9
tags: tags:
- apt-caching-nameserver - apt-caching-nameserver
@@ -128,7 +127,7 @@
when: when:
- ansible_facts["distribution"] == "Debian" - ansible_facts["distribution"] == "Debian"
- inventory_hostname in groups["gateway_server"] - inventory_hostname in groups["gateway_server"]
# - not file_named_conf_options.stat.exists # - not common_file_named_conf_options.stat.exists
# -------------------- # --------------------