Date Added | Description | Link |
---|---|---|
2019-11-26 | CloudInit Docs | https://cloudinit.readthedocs.io/en/latest/v |
2019-11-26 | Cloud-init for Vsphere | https://blah.cloud/infrastructure/using-cloud-init-for-vm-templating-on-vsphere/ |
2019-11-26 | DO Cloud-Init Intro | https://www.digitalocean.com/community/tutorials/an-introduction-to-cloud-config-scripting |
2019-11-26 | DO Cloud-Init Tutorial | https://www.digitalocean.com/community/tutorials/how-to-use-cloud-config-for-your-initial-server-setup |
2019-11-26 | VMware Cloud Init Guestinfo | https://github.com/vmware/cloud-init-vmware-guestinfo |
this assumes you have 3 things - cloud-config script - network-config script - metadata.json
vmtoolsd --cmd 'info-get /vm/path'
$ export CLOUD_CONFIG=$(gzip -c9 <cloud-config.yaml | base64)
$ export METADATA=$(sed 's~NETWORK_CONFIG~'"$(gzip -c9 <network.config.yaml | \
base64)"'~' <metadata.json | gzip -9 | base64)
$ govc vm.change -vm "${VM}" -e guestinfo.metadata="${METADATA}"
$ govc vm.change -vm "${VM}" -e guestinfo.metadata.encoding=gzip+base64
$ govc vm.change -vm "${VM}" -e guestinfo.userdata="${CLOUD_CONFIG}"
$ govc vm.change -vm "${VM}" -e guestinfo.userdata.encoding=gzip+base64
Guestinfo can be assigned to VMs using the vmware-cmd command on the console, or a tool like PowerCLI or govc.
not sure if this actually works
mkpasswd --method=SHA-512 --rounds=4096
$ govc ls
$ govc ls /datacenter/
$ govc ls /datacenter/vm/
$ export VM="/datacenter/vm/vm-name"
$ cd guesttools
$ export CLOUD_CONFIG=$(gzip -c9 <cloud-config.yaml | base64)
$ export METADATA=$(sed 's~NETWORK_CONFIG~'"$(gzip -c9 <network.config.yaml | \
base64)"'~' <metadata.json | gzip -9 | base64)
$ govc vm.change -vm "${VM}" -e guestinfo.metadata="${METADATA}"
$ govc vm.change -vm "${VM}" -e guestinfo.metadata.encoding=gzip+base64
$ govc vm.change -vm "${VM}" -e guestinfo.userdata="${CLOUD_CONFIG}"
$ govc vm.change -vm "${VM}" -e guestinfo.userdata.encoding=gzip+base64
source ~/Dropbox/src/govc-winternotch-vars.sh
govc ls /Winternotch/vm
export VM="/Winternotch/vm/centos7-vm"
export CLOUD_CONFIG=$(gzip -c9 < guesttools/winternotch-cloud-config.yaml | base64)
export METADATA=$(sed 's~NETWORK_CONFIG~'"$(gzip -c9 < guesttools/winternotch-network-config.yaml | \
base64)"'~' <guesttools/metadata.json | gzip -9 | base64)
govc vm.change -vm "${VM}" -e guestinfo.metadata="${METADATA}"
govc vm.change -vm "${VM}" -e guestinfo.metadata.encoding=gzip+base64
govc vm.change -vm "${VM}" -e guestinfo.userdata="${CLOUD_CONFIG}"
govc vm.change -vm "${VM}" -e guestinfo.userdata.encoding=gzip+base64