Files
ansible-pull/roles/nameserver/tasks/install_bind.yml
T
rene 31a6a3e3d7 facts: migrate bare ansible_* facts to ansible_facts[]
ansible-core deprecates injecting top-level facts as variables
(INJECT_FACTS_AS_VARS) and will stop doing so in 2.24. Convert all
remaining bare fact references (ansible_default_ipv4/ipv6, os_family,
distribution_release, date_time, ...) to the ansible_facts[] form.

Also fixes a typo (ansbile_date_time) in the postfix backup task.
2026-10-22 18:22:34 +02:00

26 lines
1.1 KiB
YAML
Executable File

- name: nameserver | bind | install packages
package:
name: "{{ bind_package }}"
state: present
- name: nameserver | bind | basic configuration
replace:
path: "{{ named_conf_options }}"
regexp: "{{ item.regexp }}"
replace: "{{ item.option }}"
validate: "{{ named_checkconf }} %s"
loop:
- { regexp: '^\s*listen-on \{(?:[\s\n]*(?:\d{1,3}\.){3}\d{1,3};)*[\s\n]*\};', option: "\tlisten-on { {{ ansible_facts['default_ipv4']['address'] }}; };"}
- { regexp: '^\s*listen-on-v6 \{[\s\n]*any;[\s\n]*\};', option: "\tlisten-on-v6 { {{ ansible_facts['default_ipv6']['address'] }}; };"}
- { regexp: '^\s*listen-on-v6 \{(?:[\s\n]*[\da-z:]*;)[\s\n]*\};', option: "\tlisten-on-v6 { {{ ansible_facts['default_ipv6']['address'] }}; };"}
notify: restart_named
- name: nameserver | bind | basic configuration cont'd
lineinfile:
path: "{{ named_conf_options }}"
regexp: '^\s*listen-on \{.*\};'
state: present
line: "\tlisten-on { {{ ansible_facts['default_ipv4']['address'] }}; };"
insertafter: "options {"
validate: "{{ named_checkconf }} %s"
notify: restart_named