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.
This commit is contained in:
Will Miller 2018-09-10 14:45:37 +00:00
parent 67e8f747d4
commit 956351629f
3 changed files with 11 additions and 20 deletions

View File

@ -1,12 +1,16 @@
Veth Pair Veth Pair
========= =========
This role creates a veth pair. It will plug one end into the specified OVS This role manages a veth pair. Actions:
bridge and, optionally, can plug the other end into a source Linux bridge. If
`veth_pair_state` is `absent`, it will ensure the veth pair is not plugged into * If `veth_pair_state` is `present`, it will create the veth pair and
the OVS bridge; if `veth_pair_plug_into_source` is enabled, it will ensure the plug one end into the specified OVS bridge. If `veth_pair_plug_into_source`
veth pair is not plugged into the source bridge; finally, it will ensure the is enabled, it will also plug the other end into/from a source Linux
veth pair itself does not exist. bridge.
* If `veth_pair_state` is `absent`, it will ensure the veth pair does not exist; if
`veth_pair_plug_into_source` is also enabled, it will ensure the veth pair is
not plugged into the source bridge.
Requirements Requirements
------------ ------------

View File

@ -1,11 +1,4 @@
--- ---
- name: Unplug veth from OVS bridge
openvswitch_port:
bridge: "{{ veth_pair_ovs_bridge }}"
port: "{{ veth_pair_ovs_link_name }}"
state: absent
become: true
- name: Unplug veth from source bridge - name: Unplug veth from source bridge
command: >- command: >-
brctl delif {{ veth_pair_source_bridge }} brctl delif {{ veth_pair_source_bridge }}

View File

@ -1,8 +1,2 @@
--- ---
- name: Ensure veth pair is absent - include_tasks: "{{ veth_pair_state }}.yml"
include_tasks: absent.yml
when: veth_pair_state == 'absent'
- name: Ensure veth pair is present
include_tasks: present.yml
when: veth_pair_state != 'absent'