aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/kubernetes/roles/setup-k8s-network')
-rw-r--r--deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/tasks/RedHat.yml11
-rw-r--r--deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/templates/ifcfg-sriov.j212
-rw-r--r--deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/vars/main.yml7
3 files changed, 30 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/tasks/RedHat.yml b/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/tasks/RedHat.yml
index c59fdfc5..5b434dbe 100644
--- a/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/tasks/RedHat.yml
+++ b/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/tasks/RedHat.yml
@@ -36,6 +36,17 @@
src: ifcfg-eth.j2
dest: /etc/sysconfig/network-scripts/ifcfg-{{sys_intf_mappings["external"]["interface"]}}
+- name: generate ifcfg-sriov
+ template:
+ src: ifcfg-sriov.j2
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{ intf_sriov }}
+ when: intf_sriov|length > 0
+
+- name: remove ifcfg-br-sriov script
+ file:
+ path: /etc/sysconfig/network-scripts/ifcfg-br-sriov
+ state: absent
+
- name: remove defualt gw
lineinfile:
dest: /etc/sysconfig/network
diff --git a/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/templates/ifcfg-sriov.j2 b/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/templates/ifcfg-sriov.j2
new file mode 100644
index 00000000..c4005854
--- /dev/null
+++ b/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/templates/ifcfg-sriov.j2
@@ -0,0 +1,12 @@
+DEVICE={{ intf_sriov }}
+BOOTPROTO=none
+ONBOOT=yes
+IPADDR={{ ip_settings[inventory_hostname]["tenant"]["ip"] }}
+NETMASK=255.255.255.0
+DEFROUTE="no"
+{% if sys_intf_mappings["tenant"]["vlan_tag"] | int %}
+{% set intf_vlan = "yes" %}
+{% else %}
+{% set intf_vlan = "no" %}
+{% endif %}
+VLAN={{ intf_vlan }}
diff --git a/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/vars/main.yml b/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/vars/main.yml
new file mode 100644
index 00000000..e525bf5c
--- /dev/null
+++ b/deploy/adapters/ansible/kubernetes/roles/setup-k8s-network/vars/main.yml
@@ -0,0 +1,7 @@
+---
+intf_sriov: |-
+ {%- set intf_sriov = sys_intf_mappings["tenant"]["interface"] %}
+ {%- if sys_intf_mappings["tenant"]["vlan_tag"] | int %}
+ {%- set intf_sriov = intf_sriov + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %}
+ {%- endif %}
+ {{- intf_sriov }}