|
160 | 160 | when: inventory_hostname in groups['master_nodes']
|
161 | 161 | become: true
|
162 | 162 |
|
163 |
| -- pause: |
164 |
| - seconds: 15 |
| 163 | +- name: deploy sriov plugins |
| 164 | + block: |
| 165 | + - name: Get number of VF's available for the "{{ core.data_iface }}" |
| 166 | + shell: ip link show "{{ core.data_iface }}"|grep -c vf |
| 167 | + register: vf_status |
| 168 | + changed_when: false |
| 169 | + |
| 170 | + - debug: |
| 171 | + var=vf_status.stdout |
| 172 | + |
| 173 | + - name: verify the required VF resourses available in "{{ core.data_iface }}" |
| 174 | + ansible.builtin.assert: |
| 175 | + that: |
| 176 | + - vf_status.stdout | int >= 2 |
| 177 | + |
| 178 | + - name: copy sriov-device-plugin.yaml to /tmp/sriov-device-plugin.yaml |
| 179 | + template: |
| 180 | + src: roles/router/templates/sriov-device-plugin.yaml |
| 181 | + dest: "/tmp/sriov-device-plugin.yaml" |
| 182 | + |
| 183 | + - name: copy sriov-device-plugin-config.yaml to /tmp/sriov-device-plugin-config.yaml |
| 184 | + template: |
| 185 | + src: roles/router/templates/sriov-device-plugin-config.yaml |
| 186 | + dest: "/tmp/sriov-device-plugin-config.yaml" |
| 187 | + |
| 188 | + - name: update proper data interface name in /tmp/sriov-device-plugin-config.yaml |
| 189 | + shell: sed -i -e "s/PFDEV/{{ core.data_iface }}/g" /tmp/sriov-device-plugin-config.yaml |
| 190 | + |
| 191 | + - name: apply /tmp/sriov-device-plugin.yaml |
| 192 | + shell: kubectl apply -f /tmp/sriov-device-plugin.yaml |
| 193 | + |
| 194 | + - name: apply /tmp/sriov-device-plugin-config.yaml |
| 195 | + shell: kubectl apply -f /tmp/sriov-device-plugin-config.yaml |
| 196 | + |
| 197 | + - name: Get Sriov Pods Status |
| 198 | + shell: kubectl get pods -A |grep sriov |
| 199 | + register: pod_status |
| 200 | + changed_when: false |
| 201 | + |
| 202 | + - name: restart sriov Pod |
| 203 | + shell: | |
| 204 | + while IFS= read -r line; do |
| 205 | + name=$(echo "$line" | awk '{print $2}') |
| 206 | + status=$(echo "$line" | awk '{print $4}') |
| 207 | +
|
| 208 | + kubectl delete pod "$name" |
| 209 | + done <<< "{{ pod_status.stdout }}" |
| 210 | + args: |
| 211 | + executable: /bin/bash |
| 212 | + when: inventory_hostname in groups['master_nodes'] and core.upf.sriov |
| 213 | + always: |
| 214 | + - pause: |
| 215 | + seconds: 10 |
0 commit comments