
The ipaddr filter has been removed from ansible.netcommon from version 8 onwards. Functionality has been moved to ansible.utils. The full name "ansible.utils.ipaddr" must be used for compatibility. Related-Bug: #2107335 Change-Id: Iac4c9f98b12dccd50fd42a7d33575aadfb1f1114
25 lines
1.0 KiB
YAML
25 lines
1.0 KiB
YAML
---
|
|
- name: Ensure all-in-one network bridge and dummy interfaces exist
|
|
become: true
|
|
command: "{{ item }}"
|
|
with_items:
|
|
- "ip l add {{ bridge_interface }} type bridge"
|
|
- "ip l add {{ bridge_port_interface }} type dummy"
|
|
|
|
- name: Ensure all-in-one network bridge interface exists
|
|
vars:
|
|
bridge_cidr: "{{ bridge_ip }}/{{ bridge_prefix }}"
|
|
bridge_broadcast: "{{ bridge_cidr | ansible.utils.ipaddr('broadcast') }}"
|
|
command: "{{ item }}"
|
|
become: true
|
|
with_items:
|
|
- "ip l set {{ bridge_interface }} up"
|
|
- "ip a add {{ bridge_cidr }} brd {{ bridge_broadcast }} dev {{ bridge_interface }}"
|
|
# NOTE(mgoddard): CentOS 8 removes interfaces from their bridge during
|
|
# ifdown, and removes the bridge if there are no interfaces left. When
|
|
# Kayobe bounces veth links plugged into the bridge, it causes the
|
|
# bridge which has the IP we are using for SSH to be removed. Use a
|
|
# dummy interface.
|
|
- "ip l set {{ bridge_port_interface }} up"
|
|
- "ip l set {{ bridge_port_interface }} master {{ bridge_interface }}"
|