#!/usr/bin/env bash export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Veth cleanup for items in the container_networks data structure {% for key, value in lxc_container_networks_combined.items() %} {% if value.type is not defined or value.type == 'veth' %} ip link del {{ lxc_container_network_veth_pair_prefix }}_{{ value.interface }} || true {% if 'bridge_type' in value and value.bridge_type == "openvswitch" %} {% set lxc_container_network_ovs_port_indexed = lxc_container_network_veth_pair_prefix ~ "_" ~ value.interface %} ovs-vsctl --if-exists del-port {{ lxc_container_network_ovs_port_indexed[-15:] }} || true {% endif %} {% endif %} {% endfor %}