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 ##############################################################################
14 if sudo virsh list --all | grep "${VM_NAME}.*running" ; then
15 sudo virsh destroy $VM_NAME
17 if sudo virsh list --all | grep "${VM_NAME}" ; then
18 sudo virsh undefine $VM_NAME
20 sudo rm -rf /var/lib/libvirt/images/$VM_NAME
27 ./create_vm.sh $VM_NAME
34 sudo virsh domifaddr ${VM_NAME} | awk 'FNR == 3 {gsub(/\/.*/, ""); print $4}'
40 ssh -o StrictHostKeyChecking=no -tT $USERNAME@$(get_vm_ip) << EOF
41 sudo ifconfig $PXE_IF up
42 sudo ifconfig $PXE_IF $PXE_IF_IP netmask $NETMASK
43 sudo ifconfig $PXE_IF hw ether $PXE_IF_MAC
47 # Copy files needed by Infra engine & BMRA in the jumphost VM
50 scp -r -o StrictHostKeyChecking=no $CURRENTPATH/{hw_config/$VENDOR/,sw_config/$INSTALLER/} \
51 $USERNAME@$(get_vm_ip):$PROJECT_ROOT
58 ssh -tT $USERNAME@$(get_vm_ip) << EOF
59 # Install and run cloud-infra
60 if [ ! -d "${PROJECT_ROOT}/engine" ]; then
61 ssh-keygen -t rsa -N "" -f ${PROJECT_ROOT}/.ssh/id_rsa
62 git clone https://gerrit.nordix.org/infra/engine.git
63 cp $PROJECT_ROOT/$VENDOR/{pdf.yaml,idf.yaml} ${PROJECT_ROOT}/engine/engine
64 # sudo mkdir /httpboot && sudo cp -r ${PROJECT_ROOT}/deployment_image.qcow2 /httpboot #will be removed when centos image path will be added in infra-engine
66 cd ${PROJECT_ROOT}/engine/engine && ./deploy.sh -s ironic -d centos7 \
67 -p file:///${PROJECT_ROOT}/engine/engine/pdf.yaml -i file:///${PROJECT_ROOT}/engine/engine/idf.yaml
71 # Setup networking on provisioned hosts (Adapt setup_network.sh according to your network setup)
75 ssh -tT $USERNAME@$(get_vm_ip) << EOF
76 ssh -o StrictHostKeyChecking=no root@$MASTER_IP 'bash -s' < ${PROJECT_ROOT}/${VENDOR}/setup_network.sh
77 ssh -o StrictHostKeyChecking=no root@$WORKER_IP 'bash -s' < ${PROJECT_ROOT}/${VENDOR}/setup_network.sh
81 # k8s Provisioning (currently BMRA)
85 ssh -tT $USERNAME@$(get_vm_ip) << EOF
87 if [ ! -d "${PROJECT_ROOT}/container-experience-kits" ]; then
88 curl -fsSL https://get.docker.com/ | sh
89 printf "Waiting for docker service..."
90 until sudo docker info; do
94 git clone https://github.com/intel/container-experience-kits.git
95 cd ${PROJECT_ROOT}/container-experience-kits
97 git submodule update --init
98 cp -r examples/group_vars examples/host_vars .
99 cp ${PROJECT_ROOT}/${INSTALLER}/inventory.ini ${PROJECT_ROOT}/container-experience-kits/
100 cp ${PROJECT_ROOT}/${INSTALLER}/all.yml ${PROJECT_ROOT}/container-experience-kits/group_vars/
101 cp ${PROJECT_ROOT}/${INSTALLER}/node1.yml ${PROJECT_ROOT}/container-experience-kits/host_vars/
103 sudo service docker start
104 sudo docker run --rm -v ${PROJECT_ROOT}/container-experience-kits:/bmra -v ~/.ssh/:/root/.ssh/ \
105 rihabbanday/bmra-install:centos ansible-playbook -i /bmra/inventory.ini /bmra/playbooks/cluster.yml