Use more dynamic group config for dna-gw hosts

This commit is contained in:
Timo Makinen 2025-06-17 20:36:12 +00:00
parent 911f22d3a5
commit 1ac05ad5cc

View file

@ -2,29 +2,38 @@
# increase memory size
mem_size: 512
intnet_netmask: "{{ network_interfaces[0].netmask }}"
intnet_prefix: >-
{% set ip = network_interfaces[0].ipaddr.split('.') -%}
{% if intnet_netmask == '255.255.252.0' -%}
{{ [ ip[0], ip[1], ip[2] | int - 1 ] | join('.') -}}
{% else -%}
{{ [ ip[0], ip[1], ip[2] ] | join('.') -}}
{% endif -%}
network_vip_interfaces:
- device: vio0
vhid: 1
ipaddr: 172.20.20.1
netmask: 255.255.252.0
ipaddr: "{{ intnet_prefix }}.1"
netmask: "{{ intnet_netmask }}"
pass: "{{ vip1_pass }}"
priority: 120
- device: vio0
vhid: 10
ipaddr: 172.20.20.10
netmask: 255.255.252.0
ipaddr: "{{ intnet_prefix }}.10"
netmask: "{{ intnet_netmask }}"
pass: "{{ vip10_pass }}"
priority: 120
- device: vio0
vhid: 11
ipaddr: 172.20.20.11
netmask: 255.255.252.0
ipaddr: "{{ intnet_prefix }}.11"
netmask: "{{ intnet_netmask }}"
pass: "{{ vip11_pass }}"
priority: "{{ vip11_priority }}"
- device: vio0
vhid: 12
ipaddr: 172.20.20.12
netmask: 255.255.252.0
ipaddr: "{{ intnet_prefix }}.12"
netmask: "{{ intnet_netmask }}"
pass: "{{ vip12_pass }}"
priority: "{{ vip12_priority }}"
network_ether_interfaces:
@ -43,4 +52,4 @@ ifstated_config: ifstated-dna.conf.j2
# ssh host alaises
ssh_hostnames:
- gw.home.foo.sh
- "gw.{{ inventory_hostname.split('.')[1] }}.foo.sh"