master
Brie Bruns 4 years ago
parent b9b3ca9aa0
commit 6afc694224
  1. 5
      config
  2. 2
      meta-data
  3. 20
      virt-install-cloud.sh

@ -25,4 +25,7 @@ CONVERT=yes
# Addresses to use by default for name servers
nameserver1="8.8.8.8"
nameserver2="1.1.1.1"
nameserver2="1.1.1.1"
# Create ISO via method (genisoimage, xorriso, or cloud-localds)
iso_method="xorriso"

@ -2,4 +2,4 @@ instance-id: iid-%GUEST_NAME%;
hostname: %GUEST_NAME%
local-hostname: %GUEST_NAME%
manage_resolv_conf: true
dsmode: local
dsmode: local

@ -138,7 +138,9 @@ elif [[ $virt_netinfo_type == "1" ]]; then
sed -e "s/%DOMAIN%/${domain}/" -e "s/%IP_ADDRESS%/${virt_netinfo_address}/" -e "s/%NETMASK%/${virt_netinfo_netmask}/" \
-e "s/%GATEWAY%/${virt_netinfo_gateway}/" -e "s/%NAMESERVER1%/${nameserver1}/" -e "s/%NAMESERVER2%/${nameserver2}/" \
${WORKING_DIR}/network/network-config-v1 > ${WORKING_DIR}/output/network-config
extra_iso_files=" -map $WORKING_DIR/output/network-config network-config"
extra_iso_files_xorriso=" -map $WORKING_DIR/output/network-config network-config"
extra_iso_files_genisoimage="${WORKING_DIR}/output/network-config"
extra_iso_files_cloud-localds="-N ${WORKING_DIR}/output/network-config"
fi
elif [[ $virt_netinfo_type == "2" ]]; then
echo "Not implemented yet!"
@ -163,8 +165,18 @@ fi
# write the two cloud-init files into an ISO
echo "Preparing ISO file required by cloud-init..."
#genisoimage -input-charset utf8 -output configuration.iso -volid cidata -joliet -rock user-data meta-data
xorriso -in_charset utf8 -outdev configuration.iso -volid cidata -joliet on -rockridge on -map output/user-data user-data -map output/meta-data meta-data ${extra_iso_files}
case $iso_method in
genisoimage)
genisoimage -input-charset utf8 -output configuration.iso -volid cidata -joliet -rock ${WORKING_DIR}/output/user-data ${WORKING_DIR}/output/meta-data ${extra_iso_files_genisoimage}
;;
xorriso)
xorriso -in_charset utf8 -outdev configuration.iso -volid cidata -joliet on -rockridge on -map output/user-data user-data -map output/meta-data meta-data ${extra_iso_files_xorriso}
;;
cloud-localds)
cloud-localds ${WORKING_DIR}/configuration.iso ${WORKING_DIR}/output/user-data ${WORKING_DIR}/output/meta-data ${extra_iso_files_cloud-localds}
;;
esac
# keep a backup of the files for future reference
if [[ "${BACKUP_ISO_FILES}" == "yes" ]]; then
@ -220,4 +232,4 @@ sleep 5
virsh change-media ${hostname}.${domain} vdb --eject --config
# cleanup
rm configuration.iso output/meta-data output/user-data
rm configuration.iso output/meta-data output/user-data output/network-config

Loading…
Cancel
Save