From: Matt Birkholz Date: Sun, 27 Oct 2024 20:23:39 +0000 (-0700) Subject: Replace "ipaddr" with "ansible.utils.ipaddr"(?). X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=cb8e972772284b670d40d907646cf0d8d90de3c5;p=Institute Replace "ipaddr" with "ansible.utils.ipaddr"(?). --- diff --git a/README.org b/README.org index 6b45122..4c3bb86 100644 --- a/README.org +++ b/README.org @@ -826,22 +826,32 @@ e.g. ~_net_and_mask~ rather than ~_net_cidr~. #+CAPTION: [[file:private/vars.yml][=private/vars.yml=]] #+BEGIN_SRC conf :tangle private/vars.yml -private_net: "{{ private_net_cidr | ipaddr('network') }}" -private_net_mask: "{{ private_net_cidr | ipaddr('netmask') }}" -private_net_and_mask: "{{ private_net }} {{ private_net_mask }}" -public_vpn_net: "{{ public_vpn_net_cidr | ipaddr('network') }}" -public_vpn_net_mask: "{{ public_vpn_net_cidr | ipaddr('netmask') }}" +private_net: + "{{ private_net_cidr | ansible.utils.ipaddr('network') }}" +private_net_mask: + "{{ private_net_cidr | ansible.utils.ipaddr('netmask') }}" +private_net_and_mask: + "{{ private_net }} {{ private_net_mask }}" +public_vpn_net: + "{{ public_vpn_net_cidr | ansible.utils.ipaddr('network') }}" +public_vpn_net_mask: + "{{ public_vpn_net_cidr | ansible.utils.ipaddr('netmask') }}" public_vpn_net_and_mask: "{{ public_vpn_net }} {{ public_vpn_net_mask }}" -campus_vpn_net: "{{ campus_vpn_net_cidr | ipaddr('network') }}" -campus_vpn_net_mask: "{{ campus_vpn_net_cidr | ipaddr('netmask') }}" +campus_vpn_net: + "{{ campus_vpn_net_cidr | ansible.utils.ipaddr('network') }}" +campus_vpn_net_mask: + "{{ campus_vpn_net_cidr | ansible.utils.ipaddr('netmask') }}" campus_vpn_net_and_mask: "{{ campus_vpn_net }} {{ campus_vpn_net_mask }}" -gate_wifi_net: "{{ gate_wifi_net_cidr | ipaddr('network') }}" -gate_wifi_net_mask: "{{ gate_wifi_net_cidr | ipaddr('netmask') }}" +gate_wifi_net: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('network') }}" +gate_wifi_net_mask: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('netmask') }}" gate_wifi_net_and_mask: "{{ gate_wifi_net }} {{ gate_wifi_net_mask }}" -gate_wifi_broadcast: "{{ gate_wifi_net_cidr | ipaddr('broadcast') }}" +gate_wifi_broadcast: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('broadcast') }}" #+END_SRC The institute prefers to configure its services with IP addresses @@ -871,18 +881,23 @@ The following code block picks the obvious IP addresses for Core #+CAPTION: [[file:private/vars.yml][=private/vars.yml=]] #+BEGIN_SRC conf :tangle private/vars.yml -core_addr_cidr: "{{ private_net_cidr | ipaddr('1') }}" -gate_addr_cidr: "{{ private_net_cidr | ipaddr('2') }}" -gate_wifi_addr_cidr: "{{ gate_wifi_net_cidr | ipaddr('1') }}" -wifi_wan_addr_cidr: "{{ gate_wifi_net_cidr | ipaddr('2') }}" -front_private_addr_cidr: "{{ public_vpn_net_cidr | ipaddr('1') }}" - -core_addr: "{{ core_addr_cidr | ipaddr('address') }}" -gate_addr: "{{ gate_addr_cidr | ipaddr('address') }}" -gate_wifi_addr: "{{ gate_wifi_addr_cidr | ipaddr('address') }}" -wifi_wan_addr: "{{ wifi_wan_addr_cidr | ipaddr('address') }}" +core_addr_cidr: "{{ private_net_cidr | ansible.utils.ipaddr('1') }}" +gate_addr_cidr: "{{ private_net_cidr | ansible.utils.ipaddr('2') }}" +gate_wifi_addr_cidr: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('1') }}" +wifi_wan_addr_cidr: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('2') }}" +front_private_addr_cidr: + "{{ public_vpn_net_cidr | ansible.utils.ipaddr('1') }}" + +core_addr: "{{ core_addr_cidr | ansible.utils.ipaddr('address') }}" +gate_addr: "{{ gate_addr_cidr | ansible.utils.ipaddr('address') }}" +gate_wifi_addr: + "{{ gate_wifi_addr_cidr | ansible.utils.ipaddr('address') }}" +wifi_wan_addr: + "{{ wifi_wan_addr_cidr | ansible.utils.ipaddr('address') }}" front_private_addr: - "{{ front_private_addr_cidr | ipaddr('address') }}" + "{{ front_private_addr_cidr | ansible.utils.ipaddr('address') }}" #+END_SRC @@ -2715,19 +2730,19 @@ zone "{{ domain_priv }}." { file "/etc/bind/db.domain"; }; -zone "{{ private_net_cidr | ipaddr('revdns') +zone "{{ private_net_cidr | ansible.utils.ipaddr('revdns') | regex_replace('^0\.','') }}" { type master; file "/etc/bind/db.private"; }; -zone "{{ public_vpn_net_cidr | ipaddr('revdns') +zone "{{ public_vpn_net_cidr | ansible.utils.ipaddr('revdns') | regex_replace('^0\.','') }}" { type master; file "/etc/bind/db.public_vpn"; }; -zone "{{ campus_vpn_net_cidr | ipaddr('revdns') +zone "{{ campus_vpn_net_cidr | ansible.utils.ipaddr('revdns') | regex_replace('^0\.','') }}" { type master; file "/etc/bind/db.campus_vpn"; diff --git a/private/vars.yml b/private/vars.yml index 5ed9058..f68ae8d 100644 --- a/private/vars.yml +++ b/private/vars.yml @@ -6,35 +6,50 @@ public_vpn_net_cidr: 10.177.86.0/24 campus_vpn_net_cidr: 10.84.138.0/24 gate_wifi_net_cidr: 192.168.57.0/24 -private_net: "{{ private_net_cidr | ipaddr('network') }}" -private_net_mask: "{{ private_net_cidr | ipaddr('netmask') }}" -private_net_and_mask: "{{ private_net }} {{ private_net_mask }}" -public_vpn_net: "{{ public_vpn_net_cidr | ipaddr('network') }}" -public_vpn_net_mask: "{{ public_vpn_net_cidr | ipaddr('netmask') }}" +private_net: + "{{ private_net_cidr | ansible.utils.ipaddr('network') }}" +private_net_mask: + "{{ private_net_cidr | ansible.utils.ipaddr('netmask') }}" +private_net_and_mask: + "{{ private_net }} {{ private_net_mask }}" +public_vpn_net: + "{{ public_vpn_net_cidr | ansible.utils.ipaddr('network') }}" +public_vpn_net_mask: + "{{ public_vpn_net_cidr | ansible.utils.ipaddr('netmask') }}" public_vpn_net_and_mask: "{{ public_vpn_net }} {{ public_vpn_net_mask }}" -campus_vpn_net: "{{ campus_vpn_net_cidr | ipaddr('network') }}" -campus_vpn_net_mask: "{{ campus_vpn_net_cidr | ipaddr('netmask') }}" +campus_vpn_net: + "{{ campus_vpn_net_cidr | ansible.utils.ipaddr('network') }}" +campus_vpn_net_mask: + "{{ campus_vpn_net_cidr | ansible.utils.ipaddr('netmask') }}" campus_vpn_net_and_mask: "{{ campus_vpn_net }} {{ campus_vpn_net_mask }}" -gate_wifi_net: "{{ gate_wifi_net_cidr | ipaddr('network') }}" -gate_wifi_net_mask: "{{ gate_wifi_net_cidr | ipaddr('netmask') }}" +gate_wifi_net: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('network') }}" +gate_wifi_net_mask: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('netmask') }}" gate_wifi_net_and_mask: "{{ gate_wifi_net }} {{ gate_wifi_net_mask }}" -gate_wifi_broadcast: "{{ gate_wifi_net_cidr | ipaddr('broadcast') }}" - -core_addr_cidr: "{{ private_net_cidr | ipaddr('1') }}" -gate_addr_cidr: "{{ private_net_cidr | ipaddr('2') }}" -gate_wifi_addr_cidr: "{{ gate_wifi_net_cidr | ipaddr('1') }}" -wifi_wan_addr_cidr: "{{ gate_wifi_net_cidr | ipaddr('2') }}" -front_private_addr_cidr: "{{ public_vpn_net_cidr | ipaddr('1') }}" - -core_addr: "{{ core_addr_cidr | ipaddr('address') }}" -gate_addr: "{{ gate_addr_cidr | ipaddr('address') }}" -gate_wifi_addr: "{{ gate_wifi_addr_cidr | ipaddr('address') }}" -wifi_wan_addr: "{{ wifi_wan_addr_cidr | ipaddr('address') }}" +gate_wifi_broadcast: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('broadcast') }}" + +core_addr_cidr: "{{ private_net_cidr | ansible.utils.ipaddr('1') }}" +gate_addr_cidr: "{{ private_net_cidr | ansible.utils.ipaddr('2') }}" +gate_wifi_addr_cidr: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('1') }}" +wifi_wan_addr_cidr: + "{{ gate_wifi_net_cidr | ansible.utils.ipaddr('2') }}" +front_private_addr_cidr: + "{{ public_vpn_net_cidr | ansible.utils.ipaddr('1') }}" + +core_addr: "{{ core_addr_cidr | ansible.utils.ipaddr('address') }}" +gate_addr: "{{ gate_addr_cidr | ansible.utils.ipaddr('address') }}" +gate_wifi_addr: + "{{ gate_wifi_addr_cidr | ansible.utils.ipaddr('address') }}" +wifi_wan_addr: + "{{ wifi_wan_addr_cidr | ansible.utils.ipaddr('address') }}" front_private_addr: - "{{ front_private_addr_cidr | ipaddr('address') }}" + "{{ front_private_addr_cidr | ansible.utils.ipaddr('address') }}" core_ethernet: enp0s3 diff --git a/roles_t/core/tasks/main.yml b/roles_t/core/tasks/main.yml index 2394177..8e8fb1e 100644 --- a/roles_t/core/tasks/main.yml +++ b/roles_t/core/tasks/main.yml @@ -130,19 +130,19 @@ file "/etc/bind/db.domain"; }; - zone "{{ private_net_cidr | ipaddr('revdns') + zone "{{ private_net_cidr | ansible.utils.ipaddr('revdns') | regex_replace('^0\.','') }}" { type master; file "/etc/bind/db.private"; }; - zone "{{ public_vpn_net_cidr | ipaddr('revdns') + zone "{{ public_vpn_net_cidr | ansible.utils.ipaddr('revdns') | regex_replace('^0\.','') }}" { type master; file "/etc/bind/db.public_vpn"; }; - zone "{{ campus_vpn_net_cidr | ipaddr('revdns') + zone "{{ campus_vpn_net_cidr | ansible.utils.ipaddr('revdns') | regex_replace('^0\.','') }}" { type master; file "/etc/bind/db.campus_vpn";