====== [HOWTO] Deploy any VM with Cloud-init ====== ^ 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 | ====== Option 0 [THE OPTION]: Project Clone Wars ====== Very long to paste the script here... ===== Step 1 ===== All the documentation in its page: [[linux:cloud-init:project_clonewars|[SCRIPT] Project CloneWars.sh]] ====== Option 1: acli ====== ===== Step 1 : yaml script ===== [[linux:cloud-init:standard-cloudinit-yaml|Standard cloud-init script]] 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 ===== Step 2: Create vm ===== 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}" ===== Step 3: Start the VM ===== acli vm.on ${THEHOSTNAME} ====== Option 2: Prism ====== ===== Step 1 : yaml script ===== ==== Step 1.1: Modify cloud-init template ==== [[linux:cloud-init:standard-cloudinit-yaml|Standard cloud-init script]] ==== Step 1.2: Validate yaml ==== http://www.yamllint.com/ ===== Step 2: Create vm ===== ==== Step 2.1: Add vm in nutanix ==== Add: * Name * Cores * Memory ==== Step 2.2: Add disk from Image ==== {{:procedures:backops:linux:cloud-init:deploy_new_vm:disk.png|}} ==== Step 2.3: Add network interface ==== {{:procedures:backops:linux:cloud-init:deploy_new_vm:network.png|}} \\ With cloud init you can specify the Ip address including in UNMANAGED NETWORKS!!! \\ Sample:\\ {{:procedures:backops:linux:cloud-init:deploy_new_vm:booting_network.png|}} ==== Step 2.4: Add YAML script ==== {{:procedures:backops:linux:cloud-init:deploy_new_vm:yaml.png|}} ===== Step 3: Start the VM ===== 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 [[https://dokuwiki.ciberterminal.net/doku.php?id=salt-stack:useful_commands#accept_keys|accept keys]] to interact with the new server.