This commit is contained in:
2023-04-06 11:53:54 +02:00
parent 912ec16cdb
commit 12c86849c2
59 changed files with 1065 additions and 102 deletions

View File

@ -1,11 +1,17 @@
---
# ---
# Install 'bind' apt based OS
# ---
- name: (caching-nameserver.yml) update
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 }}"
when: apt_update|bool
when:
- ansible_distribution == "Debian"
- apt_update|bool
tags:
- apt-caching-nameserver
@ -17,7 +23,9 @@
warn: false
changed_when: _dpkg_configure.stdout_lines | length
register: _dpkg_configure
when: apt_dpkg_configure|bool
when:
- ansible_distribution == "Debian"
- apt_update|bool
tags:
- apt-caching-nameserver
@ -27,19 +35,52 @@
upgrade: "{{ apt_upgrade_type }}"
update_cache: true
dpkg_options: "{{ apt_upgrade_dpkg_options | join(',') }}"
when: apt_upgrade|bool
when:
- ansible_distribution == "Debian"
- apt_dpkg_configure|bool
tags:
- apt-caching-nameserver
- name: (caching-nameserver.yml) Install bind9 packages
- name: (caching-nameserver.yml) Install bind packages (using apt)
apt:
name: "{{ apt_bind9_pkgs }}"
name: "{{ apt_bind_pkgs }}"
state: present
when: apt_install_bind9_packages|bool == true
when:
- ansible_distribution == "Debian"
- install_bind_packages|bool == true
tags:
- apt-caching-nameserver
# ---
# Install 'bind' - yum based OS
# ---
- name: (yum.yml) Install system updates for centos systems
yum:
name: '*'
state: latest
update_cache: yes
#cache_valid_time: 3600
when:
- ansible_os_family == "RedHat"
- ansible_distribution == "CentOS"
tags:
- yum-update
- name: (yum.yml) Install bind packages (using yum)
yum:
name: "{{ yum_bind_pks }}"
state: "{{ yum_install_state }}"
when:
- ansible_os_family == "RedHat"
- ansible_distribution == "CentOS"
tags:
- yum-caching-nameserver
# ---
# Configure bind on debian systems
# --
- name: (caching-nameserver.yml) Create directory /var/log/named if it does not exist
file:
@ -48,6 +89,8 @@
owner: bind
group: bind
mode: '0755'
when:
- ansible_distribution == "Debian"
- name: (caching-nameserver.yml) update named.conf.options configuration file (normal server)
@ -64,6 +107,7 @@
- apt-caching-nameserver
- caching-nameserver
when:
- ansible_distribution == "Debian"
- inventory_hostname not in groups["gateway_server"]
# --------------------
@ -89,6 +133,7 @@
- apt-caching-nameserver
- caching-nameserver
when:
- ansible_distribution == "Debian"
- inventory_hostname in groups["gateway_server"]
# - not file_named_conf_options.stat.exists
@ -107,4 +152,6 @@
mode: '0644'
tags:
- apt-caching-nameserver
when:
- ansible_distribution == "Debian"