added autodeflate option
This commit is contained in:
parent
fa6de19f0f
commit
214070fd35
1 changed files with 31 additions and 35 deletions
|
@ -24,9 +24,11 @@ where:
|
|||
-s subnet Subnet to place server on (default to 172.16.99.xx)
|
||||
-i ip_address Specify IP address to assign (default to next available in subnet)
|
||||
-b branch Specify branch of build_ansible to use (defult prod)
|
||||
-a attach Attach existing extra disk (use full path to disK, default none)"
|
||||
-a attach Attach existing extra disk (use full path to disK, default none)
|
||||
-d autodeflate Autodeflate memory on use - default true, avoid for ipa-server"
|
||||
|
||||
# process flags
|
||||
while getopts "h:n:c:r:d:v:p:m:s:i:b:" flag
|
||||
while getopts "h:n:c:r:d:v:p:m:s:i:b:d:" flag
|
||||
do
|
||||
case "$flag" in
|
||||
n) name=${OPTARG};;
|
||||
|
@ -40,6 +42,7 @@ do
|
|||
i) ip=${OPTARG};dhcp_opts+=" -i $ip";;
|
||||
b) branch=${OPTARG};;
|
||||
a) attach=${OPTARG};;
|
||||
d) deflate=${OPTARG};;
|
||||
h) ;&
|
||||
*) echo "$usage";exit;;
|
||||
esac
|
||||
|
@ -63,21 +66,14 @@ img=`./shared_scripts/download_install_image.sh $variant`
|
|||
# determine if extra disk should be attached
|
||||
if [ -n "$attach" ]; then attach="--disk ${attach},discard=unmap";fi
|
||||
|
||||
case "$variant" in
|
||||
"archlinux")
|
||||
# create cloud-init - replace by grabbing these directly from git
|
||||
mkdir -p /tmp/cloud-init
|
||||
|
||||
|
||||
echo "#cloud-config
|
||||
users:
|
||||
#determine if deflate should be on
|
||||
if [ -n "$deflate" ]; then deflate="--memballoon model=virtio,autodeflate=on";else deflate="--memballoon model=virtio";fi
|
||||
- name: root
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILG56T1k766Cru14kyXI8WXSJwlO2sVhmH6JeRWy+mfe root@host.actcur.com" > /tmp/cloud-init/user-data
|
||||
|
||||
|
||||
# create new base VM
|
||||
virt-install --name=$name --vcpus=$cpu --memory=$memory --disk path=$path,size=$root_disk,sparse=true,discard=unmap,bus=scsi ${attach} --os-variant=$variant --network bridge=br1,mac=$mac --memballoon model=virtio,autodeflate=on --cdrom=$img --graphics vnc --cloud-init user-data="/tmp/cloud-init/user-data" --autoconsole=none
|
||||
virt-install --name=$name --vcpus=$cpu --memory=$memory --disk path=$path,size=$root_disk,sparse=true,discard=unmap,bus=scsi ${attach} --os-variant=$variant --network bridge=br1,mac=$mac $deflate --cdrom=$img --graphics vnc --cloud-init user-data="/tmp/cloud-init/user-data" --autoconsole=none
|
||||
|
||||
#wait until server is available
|
||||
echo "Waiting for server to be available"
|
||||
|
@ -109,7 +105,7 @@ users:
|
|||
sed "s/REPLACE_HOSTNAME/${lname}.actcur.com/g" ../base_files/kickstart.cfg > /tmp/kickstart.cfg
|
||||
|
||||
# create new VM
|
||||
virt-install --name=$name --vcpus=$cpu --memory=$memory --disk path=$path,size=$root_disk,sparse=true,discard=unmap,bus=scsi --os-variant=almalinux9 --network bridge=br1,mac=$mac --memballoon model=virtio,autodeflate=on --location=$img --graphics vnc --initrd-inject /tmp/kickstart.cfg --extra-args "inst.ks=file:/kickstart.cfg" --autoconsole=none
|
||||
virt-install --name=$name --vcpus=$cpu --memory=$memory --disk path=$path,size=$root_disk,sparse=true,discard=unmap,bus=scsi --os-variant=almalinux9 --network bridge=br1,mac=$mac $deflate --location=$img --graphics vnc --initrd-inject /tmp/kickstart.cfg --extra-args "inst.ks=file:/kickstart.cfg" --autoconsole=none
|
||||
|
||||
echo "server up, waiting for install to complete"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue