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
@@ -7,7 +6,7 @@
- name: (caching-nameserver.yml) update
ansible.builtin.apt:
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:
- ansible_facts["distribution"] == "Debian"
- apt_update|bool
@@ -16,9 +15,9 @@
- name: (caching-nameserver.yml) Configure any half-installed packages 'dpkg --configure -a'
ansible.builtin.command: dpkg --configure -a
register: _dpkg_configure
changed_when: (_dpkg_configure.stdout | default('')) | length > 0
failed_when: _dpkg_configure.rc != 0
register: common_dpkg_configure
changed_when: (common_dpkg_configure.stdout | default('')) | length > 0
failed_when: common_dpkg_configure.rc != 0
when:
- ansible_facts["distribution"] == "Debian"
- apt_update|bool
@@ -42,7 +41,7 @@
state: present
when:
- ansible_facts["distribution"] == "Debian"
- install_bind_packages|bool == true
- install_bind_packages|bool
tags:
- apt-caching-nameserver
@@ -53,9 +52,9 @@
- name: (yum.yml) Install system updates for centos systems
ansible.builtin.dnf:
name: "*"
state: latest
state: present
update_cache: true
#cache_valid_time: 3600
# cache_valid_time: 3600
when:
- ansible_facts.os_family == "RedHat"
- ansible_facts["distribution"] == "CentOS"
@@ -94,7 +93,7 @@
owner: root
group: bind
mode: "0644"
#validate: visudo -cf %s
# validate: visudo -cf %s
notify: Reload bind9
tags:
- apt-caching-nameserver
@@ -110,7 +109,7 @@
- name: Check if file '/etc/bind/named.conf.options' exists
ansible.builtin.stat:
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)
ansible.builtin.template:
@@ -120,7 +119,7 @@
owner: root
group: bind
mode: "0644"
#validate: visudo -cf %s
# validate: visudo -cf %s
notify: Reload bind9
tags:
- apt-caching-nameserver
@@ -128,7 +127,7 @@
when:
- ansible_facts["distribution"] == "Debian"
- inventory_hostname in groups["gateway_server"]
# - not file_named_conf_options.stat.exists
# - not common_file_named_conf_options.stat.exists
# --------------------