Refactoring + final touches

This commit is contained in:
Francesco Zimbolo
2026-04-24 12:58:56 +00:00
parent 6f6cc10aae
commit d8b60d10e0
16 changed files with 369 additions and 106 deletions

View File

@@ -0,0 +1 @@
---

View File

@@ -0,0 +1,28 @@
---
- name: Validate p2p NICs exist on this node
ansible.builtin.assert:
that:
- priv_nic_1 in ansible_facts['interfaces']
- priv_nic_2 in ansible_facts['interfaces']
fail_msg: >-
One or both p2p NICs not found on {{ inventory_hostname }}.
Expected: {{ priv_nic_1 }}, {{ priv_nic_2 }}.
Available interfaces: {{ ansible_facts['interfaces'] | join(', ') }}
- name: Configure p2p bridge in /etc/network/interfaces
ansible.builtin.blockinfile:
path: /etc/network/interfaces
marker: "# {mark} ANSIBLE MANAGED BLOCK - p2p bridge"
block: |
auto p2p
iface p2p inet static
address {{ priv_ip }}/{{ ha_vip_cidr }}
bridge-ports {{ priv_nic_1 }} {{ priv_nic_2 }}
bridge-stp on
bridge-fd 0
register: p2p_network_p2p_bridge_config
- name: Apply network config # noqa: no-handler
ansible.builtin.command: ifreload -a
changed_when: true
when: p2p_network_p2p_bridge_config is changed