From aeb3e647d4894b280f386ce4b8e41f7d25135876 Mon Sep 17 00:00:00 2001
From: riverzhang <rong.zhang@easystack.cn>
Date: Wed, 6 Dec 2017 08:15:40 -0600
Subject: [PATCH] Remove the network device created by the flannel (#2006)

* Remove the network device created by the flannel

Remove the network device created by the flannel

* Modify flannel.1 device path

Modify flannel.1 device path

* remove trailing spaces
---
 roles/reset/tasks/main.yml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml
index 77adf1205..4ca32a514 100644
--- a/roles/reset/tasks/main.yml
+++ b/roles/reset/tasks/main.yml
@@ -150,6 +150,34 @@
     - files
     - dns
 
+- name: reset | check cni network device
+  stat:
+    path: /sys/class/net/cni0
+  register: cni
+  when: kube_network_plugin == 'flannel'
+  tags:
+    - flannel
+
+- name: reset | remove the network device created by the flannel
+  command: ip link del cni0
+  when: kube_network_plugin == 'flannel' and cni.stat.exists
+  tags:
+    - flannel
+
+- name: reset | check flannel network device
+  stat:
+    path: /sys/class/net/flannel.1
+  register: flannel
+  when: kube_network_plugin == 'flannel'
+  tags:
+    - flannel
+
+- name: reset | remove the network device created by the flannel
+  command: ip link del flannel.1
+  when: kube_network_plugin == 'flannel' and flannel.stat.exists
+  tags:
+    - flannel
+
 - name: reset | Restart network
   service:
     name: >-
-- 
GitLab