Stephane Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | uId=`id -u` |
| 4 | vmName="voltha_voltha${uId}" |
| 5 | |
| 6 | # Get the VM's ip address |
| 7 | ipAddr=`virsh domifaddr $vmName | tail -n +3 | awk '{ print $4 }' | sed -e 's~/.*~~'` |
| 8 | |
| 9 | # Retrieve stable kubespray repo |
| 10 | ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \ |
| 11 | ../.vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr \ |
Stephane Barbarie | 78d9fa6 | 2018-04-19 14:11:05 -0400 | [diff] [blame] | 12 | "git clone --branch v2.5.0 https://github.com/kubernetes-incubator/kubespray.git" |
Stephane Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 13 | |
| 14 | # Setup a new ansible manifest to only download files |
| 15 | cat <<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} |
| 22 | HERE |
| 23 | |
| 24 | # Copy the manifest over to the voltha instance |
| 25 | scp -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 |
| 30 | ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \ |
| 31 | ../.vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr \ |
Stephane Barbarie | 78d9fa6 | 2018-04-19 14:11:05 -0400 | [diff] [blame] | 32 | "mkdir -p releases && cd kubespray && ANSIBLE_CONFIG=ansible.cfg ansible-playbook -v -u root -i inventory/local/hosts.ini download.yml" |
Stephane Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 33 | |
| 34 | rtrn=$? |
| 35 | |
| 36 | echo "Preload return code: $rtrn" |
| 37 | |
| 38 | exit $rtrn |
| 39 | |