aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/infra_destroy_previous_configuration/tasks/delete_network.yml
diff options
context:
space:
mode:
authorStepan Andrushko <stepanx.andrushko@intel.com>2018-04-16 14:17:54 +0300
committerStepan Andrushko <stepanx.andrushko@intel.com>2018-04-17 19:50:11 +0300
commit535aeeb3e3ccffecd0591ef388dbbfea4b51e4c3 (patch)
tree9e2535f37300c8e056b1e7b98b27c4f9cbaca468 /ansible/roles/infra_destroy_previous_configuration/tasks/delete_network.yml
parentf3f75ea39678b6da24e5ed6a61f77586f71d0128 (diff)
OpenStack deployment: delete RS or all VMs
New parameter is added to shell script to delete data for VMs either from input file or all. Added disk images removal as per new input parameter. JIRA: YARDSTICK-1123 Change-Id: I8d2cee4a3a7ad7147f4d59303bab656d80370221 Signed-off-by: Stepan Andrushko <stepanx.andrushko@intel.com>
Diffstat (limited to 'ansible/roles/infra_destroy_previous_configuration/tasks/delete_network.yml')
-rw-r--r--ansible/roles/infra_destroy_previous_configuration/tasks/delete_network.yml27
1 files changed, 16 insertions, 11 deletions
diff --git a/ansible/roles/infra_destroy_previous_configuration/tasks/delete_network.yml b/ansible/roles/infra_destroy_previous_configuration/tasks/delete_network.yml
index 314ee30af..5e616335a 100644
--- a/ansible/roles/infra_destroy_previous_configuration/tasks/delete_network.yml
+++ b/ansible/roles/infra_destroy_previous_configuration/tasks/delete_network.yml
@@ -14,18 +14,18 @@
---
- name: Destroy old networks created by virt
virt_net:
- name: "{{ network_item.name }}"
+ name: "{{ network_item }}"
command: destroy
- when: network_item.name in virt_nets.list_nets
+ when: clean_up | bool or network_item in deploy_nets
-# Ignoring erros as network can be created without being defined.
+# Ignoring errors as network can be created without being defined.
# This can happen if a user manually creates a network using the virsh command.
# If the network is not defined the undefine code will throw an error.
- name: Undefine old networks defined by virt
virt_net:
- name: "{{ network_item.name }}"
+ name: "{{ network_item }}"
command: undefine
- when: network_item.name in virt_nets.list_nets
+ when: clean_up | bool or network_item in deploy_nets
ignore_errors: yes
- name: Check if "ovs-vsctl" command is present
@@ -34,15 +34,20 @@
ignore_errors: yes
- name: Destroy OVS bridge if it exists
- command: ovs-vsctl --if-exists -- del-br "{{ network_item.name }}"
- when: ovs_vsctl_present.rc == 0
+ command: ovs-vsctl --if-exists -- del-br "{{ network_item }}"
+ when:
+ - ovs_vsctl_present.rc == 0
+ - clean_up | bool or network_item in deploy_nets
+ ignore_errors: yes
- name: Check if linux bridge is present
- stat: path="{{ '/sys/class/net/'+network_item.name+'/brif/' }}"
+ stat: path="{{ '/sys/class/net/' + network_item + '/brif/' }}"
register: check_linux_bridge
- name: Remove linux bridge if it exists
shell: |
- ifconfig "{{ network_item.name }}" down
- brctl delbr "{{ network_item.name }}"
- when: check_linux_bridge.stat.exists
+ ifconfig "{{ network_item }}" down
+ brctl delbr "{{ network_item }}"
+ when:
+ - check_linux_bridge.stat.exists
+ - clean_up | bool or network_item in deploy_nets