2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
13 if sudo virsh list --all | grep "${VM_NAME}.*running" ; then
14 sudo virsh destroy "$VM_NAME"
16 if sudo virsh list --all | grep "${VM_NAME}" ; then
17 sudo virsh undefine "$VM_NAME"
19 sudo rm -rf "/var/lib/libvirt/images/$VM_NAME"
25 ./create_vm.sh "$VM_NAME"
31 sudo virsh domifaddr "$VM_NAME" | awk 'FNR == 3 {gsub(/\/.*/, ""); print $4}'
36 ssh -o StrictHostKeyChecking=no -tT "$USERNAME"@"$(get_vm_ip)" << "EOF"
37 sudo ifconfig $PXE_IF up
38 sudo ifconfig $PXE_IF $PXE_IF_IP netmask $NETMASK
39 sudo ifconfig $PXE_IF hw ether $PXE_IF_MAC
43 # Copy files needed by Infra engine & BMRA in the jumphost VM
45 scp -r -o StrictHostKeyChecking=no \
46 "$CURRENTPATH/{hw_config/$VENDOR/,sw_config/$INSTALLER/}" \
47 "$USERNAME@$(get_vm_ip):$PROJECT_ROOT"
52 ssh -tT "$USERNAME"@"$(get_vm_ip)" << "EOF"
53 # Install and run cloud-infra
54 if [ ! -d "${PROJECT_ROOT}/engine" ]; then
55 ssh-keygen -t rsa -N "" -f ${PROJECT_ROOT}/.ssh/id_rsa
56 git clone https://gerrit.nordix.org/infra/engine.git
57 cp $PROJECT_ROOT/$VENDOR/{pdf.yaml,idf.yaml} \
58 ${PROJECT_ROOT}/engine/engine
59 # NOTE: will be removed when centos image path will be added in infra-engine
61 # sudo cp -r ${PROJECT_ROOT}/deployment_image.qcow2 /httpboot
63 cd ${PROJECT_ROOT}/engine/engine
64 ./deploy.sh -s ironic -d centos7 \
65 -p file:///${PROJECT_ROOT}/engine/engine/pdf.yaml \
66 -i file:///${PROJECT_ROOT}/engine/engine/idf.yaml
70 # Setup networking on provisioned hosts (Adapt setup_network.sh according to your network setup)
72 ssh -tT "$USERNAME"@"$(get_vm_ip)" << "EOF"
73 ssh -o StrictHostKeyChecking=no root@$MASTER_IP \
74 'bash -s' < ${PROJECT_ROOT}/${VENDOR}/setup_network.sh
75 ssh -o StrictHostKeyChecking=no root@$WORKER_IP \
76 'bash -s' < ${PROJECT_ROOT}/${VENDOR}/setup_network.sh
80 # k8s Provisioning (currently BMRA)
82 ssh -tT "$USERNAME"@"$(get_vm_ip)" << "EOF"
84 if [ ! -d "${PROJECT_ROOT}/container-experience-kits" ]; then
85 curl -fsSL https://get.docker.com/ | sh
86 printf "Waiting for docker service..."
87 until sudo docker info; do
91 git clone https://github.com/intel/container-experience-kits.git
92 cd ${PROJECT_ROOT}/container-experience-kits
94 git submodule update --init
95 cp -r examples/group_vars examples/host_vars .
96 cp ${PROJECT_ROOT}/${INSTALLER}/inventory.ini \
97 ${PROJECT_ROOT}/container-experience-kits/
98 cp ${PROJECT_ROOT}/${INSTALLER}/all.yml \
99 ${PROJECT_ROOT}/container-experience-kits/group_vars/
100 cp ${PROJECT_ROOT}/${INSTALLER}/node1.yml \
101 ${PROJECT_ROOT}/container-experience-kits/host_vars/
103 sudo service docker start
104 sudo docker run --rm \
105 -v ${PROJECT_ROOT}/container-experience-kits:/bmra \
106 -v ~/.ssh/:/root/.ssh/ rihabbanday/bmra-install:centos \
107 ansible-playbook -i /bmra/inventory.ini /bmra/playbooks/cluster.yml