Documentation | |
---|---|
Name: | [HOWTO] Deploy any VM with Cloud-init |
Description: | Step by step guide to Deploy any VM with Cloud-init |
Modification date : | 16/10/2018 |
Owner: | dodger@ciberterminal.net |
Notify changes to: | backOps tuxe's |
Tags: | cloud-init |
Very long to paste the script here…
All the documentation in its page: [SCRIPT] Project CloneWars.sh
export THEHOSTNAME=thehostname export THEIPADDRESS=theipaddress export THENETMASK=thenetmask export THEGATEWAY=thegateway cat cloud-init.TMPL.yaml| sed "s,THEHOSTNAME,${THEHOSTNAME},g" |sed "s,THEIPADDRESS,${THEIPADDRESS},g" | sed "s,THENETMASK,${THENETMASK},g" | sed "s,THEGATEWAY,${THEGATEWAY},g" > cloud-init.${THEHOSTNAME}.yaml
Connect to the CVM of the nutanix cluster.
Run acli
and clone the template:
acli uhura.vm.clone_with_customize ${THEHOSTNAME} clone_from_vm=TMPL-CentOS7.1804_v002 cloudinit_userdata_path=file:///home/nutanix/cloud-init.${THEHOSTNAME}.yaml container="Container01" acli vm.nic_delete ${THEHOSTNAME} $(acli vm.nic_list ${THEHOSTNAME}| egrep -v "^Mac Address"|awk '{print $1}') acli vm.nic_create ${THEHOSTNAME} network="${THENETWORK}"
acli vm.on ${THEHOSTNAME}
Add:
And enjoy the process in the console.
If you use the “normal” yaml script, the vm will restart at the end of the process.
And just after start, salt-minion
will register on salt-master
, you must accept keys to interact with the new server.