29 lines
985 B
YAML
29 lines
985 B
YAML
---
|
|
- 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
|