Files
tenks/ansible/roles/veth-pair/tasks/absent.yml
Will Miller 956351629f Fix veth-pair role for teardown
* Don't delete the OVS bridge specified, as it will already be deleted
  when the role is called.
* Clarify the behaviour of the role for each value of `cmd` in the
  README.
* Succintify main.yml.
2018-09-10 14:45:37 +00:00

27 lines
729 B
YAML

---
- name: Unplug veth from source bridge
command: >-
brctl delif {{ veth_pair_source_bridge }}
{{ veth_pair_source_link_name }}
register: res
failed_when:
- res.rc != 0
# Case where veth is already unplugged.
- not (res.rc == 1 and 'does not exist' in res.stderr)
changed_when: res.rc == 0
when: veth_pair_plug_into_source | bool
become: true
- name: Delete veth pair
command: >-
ip link del dev {{ veth_pair_ovs_link_name }}
type veth
peer name {{ veth_pair_source_link_name }}
register: res
failed_when:
- res.rc != 0
# Case where veth pair is already absent.
- not (res.rc == 1 and 'Cannot find device' in res.stderr)
changed_when: res.rc == 0
become: true