ansible-playbooks/playbookconfig/src/playbooks/upgrade-k8s-networking.yml
Kristine Bujold cbd597f395 Refactor Ansible sysinv data collection
This commit refactors ansible to use the sysinv-utils for generating
overrides files. It also updates CLIs to use command arguments
instead of using grep/awk. The current model can easily beak if for
example a column is added to the outputted data.

Story: 2006590
Task: 36892
Depends-On: https://review.opendev.org/693213/
Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
Change-Id: Ife65cd95c0f7c0ec431a9298965acab50aac11d7
2019-11-20 16:21:51 -05:00

72 lines
2.4 KiB
YAML

---
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
- hosts: all
vars:
upgrade_k8s_networking: true
overrides_file: "/tmp/upgrade_overrides.yaml"
tasks:
- name: Create the upgrade overrides file
command: "/usr/bin/sysinv-utils create-host-overrides {{ overrides_file }}"
failed_when: result.stderr != ""
register: result
- name: Read the overrides variables
include_vars:
file: "{{ overrides_file }}"
- name: Set networking facts
set_fact:
kubelet_cni_bin_dir: "/usr/libexec/cni"
cluster_network_ipv4: "{{ cluster_pod_subnet | ipv4 }}"
cluster_network_ipv6: "{{ cluster_pod_subnet | ipv6 }}"
cluster_floating_address: "{{ cluster_host_floating_address }}"
- name: Set images facts
include_vars:
dir: "roles/bootstrap/bringup-essential-services/vars"
files_matching: main.yml
- name: Upgrade k8s networking images
import_role:
name: common/push-docker-images
- name: Create Calico config file
template:
src: "roles/bootstrap/bringup-essential-services/templates/calico-cni.yaml.j2"
dest: /etc/kubernetes/update_calico.yaml
- name: Update Calico Networking
command: "kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f /etc/kubernetes/update_calico.yaml"
- name: Create Multus config file
template:
src: "roles/bootstrap/bringup-essential-services/templates/multus-cni.yaml.j2"
dest: /etc/kubernetes/update_multus.yaml
- name: Update Multus Networking
command: "kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f /etc/kubernetes/update_multus.yaml"
- name: Create SRIOV Networking config file
template:
src: "roles/bootstrap/bringup-essential-services/templates/sriov-cni.yaml.j2"
dest: /etc/kubernetes/update_sriov-cni.yaml
- name: Update SRIOV Networking
command: "kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f /etc/kubernetes/update_sriov-cni.yaml"
- name: Create SRIOV device plugin config file
template:
src: "roles/bootstrap/bringup-essential-services/templates/sriov-plugin.yaml.j2"
dest: /etc/kubernetes/update_sriovdp-daemonset.yaml
- name: Update SRIOV device plugin
command: "kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f /etc/kubernetes/update_sriovdp-daemonset.yaml"