blob: e80bcb97f80d5330c4c7b3eb90335f7f3ef43415 [file] [log] [blame]
Stephane Barbarie2cbffca2018-03-26 16:20:03 -04001#!/bin/bash
Zack Williams41513bf2018-07-07 20:08:35 -07002# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
Stephane Barbarie2cbffca2018-03-26 16:20:03 -040015
16uId=`id -u`
17vmName="voltha_voltha${uId}"
18
19# Get the VM's ip address
20ipAddr=`virsh domifaddr $vmName | tail -n +3 | awk '{ print $4 }' | sed -e 's~/.*~~'`
21
22# Retrieve stable kubespray repo
23ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \
24 ../.vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr \
Stephane Barbarie78d9fa62018-04-19 14:11:05 -040025 "git clone --branch v2.5.0 https://github.com/kubernetes-incubator/kubespray.git"
Stephane Barbarie2cbffca2018-03-26 16:20:03 -040026
27# Setup a new ansible manifest to only download files
28cat <<HERE > download.yml
29---
30- hosts: k8s-cluster
31 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
32 roles:
33 - { role: kubespray-defaults}
34 - { role: download, tags: download, skip_downloads: false}
35HERE
36
37# Copy the manifest over to the voltha instance
38scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \
39 ../.vagrant/machines/voltha${uId}/libvirt/private_key \
40 download.yml vagrant@$ipAddr:kubespray/download.yml
41
42# Run the manifest
43ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \
44 ../.vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr \
Stephane Barbarie78d9fa62018-04-19 14:11:05 -040045 "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 -040046
47rtrn=$?
48
49echo "Preload return code: $rtrn"
50
51exit $rtrn
52