
the openvswitch.openvswitch collection is removed from Ansible packages starting with Ansible 11. This causes ansible-lint to correctly not find the openvswitch_bridge module when ansible-lint runs with Ansible 11. Workaround this by capping Ansible used by ansible-lint to <10 and leave a note about the module going away where we use it. Change-Id: Id2d4e4f59c7d7e595c5458bc8717146c2326c573
32 lines
1.0 KiB
YAML
32 lines
1.0 KiB
YAML
- name: Ensure the bridge exists
|
|
become: yes
|
|
# TODO Ansible 11 removes this module
|
|
openvswitch_bridge:
|
|
bridge: "{{ bridge_name }}"
|
|
|
|
- name: Set the bridge MTU
|
|
become: yes
|
|
command: ip link set mtu {{ bridge_mtu }} dev {{ bridge_name }}
|
|
|
|
- name: Configure bridge address
|
|
when: bridge_configure_address
|
|
block:
|
|
- name: Verify if the bridge address is set
|
|
shell: ip addr show dev {{ bridge_name }} | grep -q {{ bridge_address_prefix }}.{{ bridge_address_offset }}/{{ bridge_address_subnet }}
|
|
environment:
|
|
PATH: '{{ ansible_env.PATH }}:/bin:/sbin:/usr/sbin'
|
|
register: ip_addr_var
|
|
failed_when: False
|
|
changed_when: False
|
|
|
|
- name: Set the bridge address
|
|
become: yes
|
|
command: ip addr add {{ bridge_address_prefix }}.{{ bridge_address_offset }}/{{ bridge_address_subnet }} dev {{ bridge_name }}
|
|
environment:
|
|
PATH: '{{ ansible_env.PATH }}:/bin:/sbin:/usr/sbin'
|
|
when: ip_addr_var.rc == 1
|
|
|
|
- name: Bring bridge interface up
|
|
become: yes
|
|
command: ip link set dev {{ bridge_name }} up
|