---
- name: Delete external network
  virt_net:
    name: "{{ networks.external.name }}"
    state: absent
  become: true

- name: Delete the OVS bridges
  openvswitch_bridge:
    bridge: "{{ item.name }}"
    state: absent
  with_items: "{{ networks.bridges }}"
  become: true

- name: Delete the bridge networks
  virt_net:
    name: "{{ item.name }}"
    state: absent
  with_items: "{{ networks.bridges }}"
  become: true

---
- name: check if bridge exists
  command: ip link show {{item.name}}
  with_items: "{{ networks.bridges }}"
  register: _bridges
  ignore_errors: true

- name: Delete external network
  virt_net:
    name: "{{ networks.external.name }}"
    state: absent
  become: true

- name: Delete the OVS bridges
  openvswitch_bridge:
    bridge: "{{ item.item.name }}"
    state: absent
  with_items: "{{ _bridges.results }}"
  when: item|success
  become: true

- name: Delete the bridge networks
  virt_net:
    name: "{{ item.name }}"
    state: absent
  with_items: "{{ networks.bridges }}"
  become: true

Check for bridges to exist before attempting to tear them down
Check for bridges to exist before attempting to tear them down

Change-Id: I3c01aade41309996cded1ced0c82e4341bfa5ed7
