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.
This commit is contained in:
rene committed 2026-10-22 18:22:34 +02:00
1 parent 52f2ac45e5
commit 31a6a3e3d7
11 files changed
+19 -19

No files matched your search

@@ -1,8 +1,8 @@
allow-from = 192.168.1.0/24, 192.168.3.0/24, 172.16.0.0/24, 127.0.0.0/8
dont-query =
forward-zones-recurse = universe.local=192.168.1.3
local-address = 127.0.0.1 {% if wg_local_ip is defined %}, {{ wg_local_ip | ansible.utils.ipaddr('address') }}{% else %}{{ ansible_default_ipv4.address }}{% endif %}
local-address = 127.0.0.1 {% if wg_local_ip is defined %}, {{ wg_local_ip | ansible.utils.ipaddr('address') }}{% else %}{{ ansible_facts['default_ipv4']['address'] }}{% endif %}
local-port = {% if pdns_recursor_lport is defined %}{{ pdns_recursor_lport }}{% else %}53{% endif %}
non-local-bind = yes
query-local-address = {{ ansible_default_ipv4.address }} {% if ansible_default_ipv6.address is defined %}, {{ ansible_default_ipv6.address }}{% endif %} {% if wg_local_ip is defined %}, {{ wg_local_ip | ansible.utils.ipaddr('address') }}{% endif %}
query-local-address = {{ ansible_facts['default_ipv4']['address'] }} {% if ansible_facts['default_ipv6'] is defined %}, {{ ansible_facts['default_ipv6']['address'] }}{% endif %} {% if wg_local_ip is defined %}, {{ wg_local_ip | ansible.utils.ipaddr('address') }}{% endif %}
@@ -1,6 +1,6 @@
api = Yes
api-key ={{ pdns_api_key | default(lookup('password', '/etc/powerdns/pdns.d/.api-key length=20')) }}
webserver = Yes
#webserver-address = {% if wg_local_ip is defined %}, {{ wg_local_ip | ansible.utils.ipaddr('address') }}{% else %}{{ ansible_default_ipv4.address }}{% endif %}
#webserver-address = {% if wg_local_ip is defined %}, {{ wg_local_ip | ansible.utils.ipaddr('address') }}{% else %}{{ ansible_facts['default_ipv4']['address'] }}{% endif %}
webserver-address = 0.0.0.0
webserver-allow-from = 127.0.0.1, [::1], 192.168.1.238
@@ -1,4 +1,4 @@
include-dir=/etc/powerdns/pdns.d
launch=
local-address={{ ansible_default_ipv4.address }}, [{{ ansible_default_ipv6.address }}], 127.0.0.1:553{% if wg_local_ip is defined %}, {{ wg_local_ip | ansible.utils.ipaddr('address') }}:553{% endif %}
local-address={{ ansible_facts['default_ipv4']['address'] }}, [{{ ansible_facts['default_ipv6']['address'] }}], 127.0.0.1:553{% if wg_local_ip is defined %}, {{ wg_local_ip | ansible.utils.ipaddr('address') }}:553{% endif %}
security-poll-suffix=
@@ -3,14 +3,14 @@ server:
{% if wg_local_ip is defined %}
interface: {{ wg_local_ip | ansible.utils.ipaddr('address') }}
{% else %}
interface: {{ ansible_default_ipv4.address }}
interface: {{ ansible_facts['default_ipv4']['address'] }}
{% endif %}
interface: 127.0.0.1
interface: 127.0.0.53
interface: ::1
outgoing-interface: {{ ansible_default_ipv4.address }}
{% if ansible_default_ipv6.address is defined %}
outgoing-interface: {{ ansible_default_ipv6.address }}
outgoing-interface: {{ ansible_facts['default_ipv4']['address'] }}
{% if ansible_facts['default_ipv6'] is defined %}
outgoing-interface: {{ ansible_facts['default_ipv6']['address'] }}
{% endif %}
access-control: 192.168.1.0/24 allow
access-control: 192.168.3.0/24 allow