blob: 248fee89043b186437bba5dcc05dc0fc3bff74b5 [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 \
Stephane Barbarie78d9fa62018-04-19 14:11:05 -040012 "git clone --branch v2.5.0 https://github.com/kubernetes-incubator/kubespray.git"
Stephane Barbarie2cbffca2018-03-26 16:20:03 -040013
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 \
Stephane Barbarie78d9fa62018-04-19 14:11:05 -040032 "mkdir -p releases && cd kubespray && ANSIBLE_CONFIG=ansible.cfg ansible-playbook -v -u root -i inventory/local/hosts.ini download.yml"
Stephane Barbarie2cbffca2018-03-26 16:20:03 -040033
34rtrn=$?
35
36echo "Preload return code: $rtrn"
37
38exit $rtrn
39