From 413f63bbe12db16f55ca7f4dd1c3663b8a112cae Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Fri, 31 Jul 2020 13:02:54 -0400 Subject: [PATCH] Set Jumpbox root's password Every OS has different root's passwords which complicates the throubleshooting process. This change sets the root password of the jumpbox to what's defined in the ROOT_PASSWORD env variable. Signed-off-by: Victor Morales Change-Id: I7b926f9500de9341a660b86ccb1c9eafbfaf6053 --- deploy.env | 1 + functions.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy.env b/deploy.env index 602dfd8..07d1bf3 100644 --- a/deploy.env +++ b/deploy.env @@ -10,3 +10,4 @@ export BRIDGE=pxebr export VM_NAME=$(yq r $CURRENTPATH/hw_config/$VENDOR/pdf.yaml jumphost.name) export USERNAME=ubuntu export PROJECT_ROOT="/home/ubuntu" +export ROOT_PASSWORD="root" # This is used for throubleshooting purposes diff --git a/functions.sh b/functions.sh index b0baf2d..5c37843 100755 --- a/functions.sh +++ b/functions.sh @@ -46,7 +46,8 @@ EOL # Create VM sudo genisoimage -output "/var/lib/libvirt/images/$VM_NAME/$VM_NAME-cidata.iso" \ -volid cidata -joliet -rock user-data meta-data - + sudo virt-customize -a "/var/lib/libvirt/images/$VM_NAME/$VM_NAME.qcow2" \ + --root-password password:"$ROOT_PASSWORD" sudo virt-install --connect qemu:///system --name "$VM_NAME" \ --ram 4096 --vcpus=4 --os-type linux --os-variant ubuntu16.04 \ --disk path="/var/lib/libvirt/images/$VM_NAME/$VM_NAME.qcow2",format=qcow2 \ -- 2.16.6