Merge pull request #3105 from mirwan/remove_cilium_device_at_reset_plus_move_network_to_network_plugin_roles
Move network_plugin specific reset tasks to its role directory
This commit is contained in:
commit
3e5b6a5481
4 changed files with 41 additions and 26 deletions
9
roles/network_plugin/cilium/tasks/reset.yml
Normal file
9
roles/network_plugin/cilium/tasks/reset.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: reset | check and remove devices if still present
|
||||||
|
include_tasks: reset_iface.yml
|
||||||
|
vars:
|
||||||
|
iface: "{{ item }}"
|
||||||
|
with_items:
|
||||||
|
- cilium_host
|
||||||
|
- cilium_net
|
||||||
|
- cilium_vxlan
|
9
roles/network_plugin/cilium/tasks/reset_iface.yml
Normal file
9
roles/network_plugin/cilium/tasks/reset_iface.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: "reset | check if network device {{ iface }} is present"
|
||||||
|
stat:
|
||||||
|
path: "/sys/class/net/{{ iface }}"
|
||||||
|
register: device_remains
|
||||||
|
|
||||||
|
- name: "reset | remove network device {{ iface }}"
|
||||||
|
command: "ip link del {{ iface }}"
|
||||||
|
when: device_remains.stat.exists
|
18
roles/network_plugin/flannel/tasks/reset.yml
Normal file
18
roles/network_plugin/flannel/tasks/reset.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: reset | check cni network device
|
||||||
|
stat:
|
||||||
|
path: /sys/class/net/cni0
|
||||||
|
register: cni
|
||||||
|
|
||||||
|
- name: reset | remove the network device created by the flannel
|
||||||
|
command: ip link del cni0
|
||||||
|
when: cni.stat.exists
|
||||||
|
|
||||||
|
- name: reset | check flannel network device
|
||||||
|
stat:
|
||||||
|
path: /sys/class/net/flannel.1
|
||||||
|
register: flannel
|
||||||
|
|
||||||
|
- name: reset | remove the network device created by the flannel
|
||||||
|
command: ip link del flannel.1
|
||||||
|
when: flannel.stat.exists
|
|
@ -167,33 +167,12 @@
|
||||||
- files
|
- files
|
||||||
- dns
|
- dns
|
||||||
|
|
||||||
- name: reset | check cni network device
|
- name: reset | include file with reset tasks specific to the network_plugin if exists
|
||||||
stat:
|
include_tasks: "{{ (role_path + '/../network_plugin/' + kube_network_plugin + '/tasks/reset.yml') | realpath }}"
|
||||||
path: /sys/class/net/cni0
|
when:
|
||||||
register: cni
|
- kube_network_plugin in ['flannel', 'cilium']
|
||||||
when: kube_network_plugin == 'flannel'
|
|
||||||
tags:
|
tags:
|
||||||
- flannel
|
- network
|
||||||
|
|
||||||
- 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
|
- name: reset | Restart network
|
||||||
service:
|
service:
|
||||||
|
|
Loading…
Reference in a new issue