blob: aab97ba0a470298abf013f3e122c29cc78ff95e2 [file] [log] [blame]
Stephane Barbarie2cbffca2018-03-26 16:20:03 -04001#!/bin/bash
2
3uId=`id -u`
4vmName="voltha_voltha${uId}"
5
6# Get the VM's ip address
7ipAddr=`virsh domifaddr $vmName | tail -n +3 | awk '{ print $4 }' | sed -e 's~/.*~~'`
8
9# Retrieve stable kubespray repo
10ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \
11 ../.vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr \
12 "git clone --branch v2.4.0 https://github.com/kubernetes-incubator/kubespray.git"
13
14# Setup a new ansible manifest to only download files
15cat <<HERE > download.yml
16---
17- hosts: k8s-cluster
18 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
19 roles:
20 - { role: kubespray-defaults}
21 - { role: download, tags: download, skip_downloads: false}
22HERE
23
24# Copy the manifest over to the voltha instance
25scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \
26 ../.vagrant/machines/voltha${uId}/libvirt/private_key \
27 download.yml vagrant@$ipAddr:kubespray/download.yml
28
29# Run the manifest
30ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \
31 ../.vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr \
32 "mkdir -p releases && cd kubespray && ANSIBLE_CONFIG=ansible.cfg ansible-playbook -v -u root -i inventory/local-tests.cfg download.yml"
33
34rtrn=$?
35
36echo "Preload return code: $rtrn"
37
38exit $rtrn
39
40
41