forked from MarcNo/openshift-home-lab
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path2-build-node.sh
executable file
·47 lines (30 loc) · 1.45 KB
/
2-build-node.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
source ./env.sh
# Could use virt-install ... --extra-args="ip=[ip]::[gateway]:[netmask]:[hostname]:[interface]:[autoconf]"
# eg:
# ip=192.168.88.123::192.168.88.1:255.255.255.0:test.example.com:eth0:none"
for i in `cat hosts.addnode|grep -v \\\\[`;
do
echo "########################################################################"
echo "[$i start]"
baseimage="$VMS/$i-base.qcow2"
image="$VMS/$i.qcow2"
dockerdisk="$VMS/$i-docker.qcow2"
glusterfsdisk="$VMS/$i-glusterfs.qcow2"
echo "[dry-run install $i w/ mac ${MACADDRESS[$i]}"
virt-install --ram $VMRAM_OCP --vcpus 4 --os-variant rhel7 --disk path=$image,device=disk,bus=virtio,format=qcow2 \
--noautoconsole --vnc --name $i --dry-run --cpu Skylake-Client,+vmx --network bridge=${BRIDGE},mac=${MACADDRESS[$i]} \
--print-xml > $VMS/$i.xml
# You may also need to change the CPU depending on the hypervisor's CPU
# --noautoconsole --vnc --name $i --dry-run --cpu Skylake-Client,+vmx --network bridge=${BRIDGE},mac=${MACADDRESS[$i]} \
echo "[define $i]"
virsh define --file $VMS/$i.xml
echo "[attach disk to $i, $dockerdisk]"
virsh attach-disk $i --source $dockerdisk --target vdb --persistent
echo "[attach disk to $i, $glusterfsdisk]"
virsh attach-disk $i --source $glusterfsdisk --target vdc --persistent
echo "[$i done]"
done
exit
echo "########################################################################"
virsh list --all