I have some services which I deploy using cloud-init on another virtualization environment.
Now I need to move to proxmox and smh need to reuse the same logic to deploy VMs.
I need it to be possible to deploy vm's with my cloud-init data as I used before. not just passign a username & password but variables and scripts via CLI.
# nice to have:
Even greater would be if someone has a CLI which works using the API and smh already includes some logic to distribute the VMs accordingly to the current usage of ressources of hosts in a cluster
this is how I passed data using cloudinit "user-data" as a .yaml file before:
```
#cloud-config
users:
- name: adminuser
sudo: ALL=(ALL) NOPASSWD:ALL
groups: sudo
shell: /bin/bash
chpasswd:
list: |
root:myPW
adminuser:myPW
expire: False
ssh_pwauth: true
disable_root: false
write_files:
- path: /root/init_script.sh
permissions: '0755'
content: |
#!/bin/bash
# Variables
timedatectl set-timezone Europe/Amsterdam
export myDOMAIN="mydomain.tld"
export myUSERCOUNT="100"
export CloudFlareAPITOKEN="myCloudFlareAPITOKEN"
# custom colors
export AK_ACCENT_NEW="#76b728"
# Monitoring & initSetupDL
export monitoring_cloudinit="https://monitor.mydomain.tld/api/push/WM9XqoCVyX?status=up&msg="
export initSetupDL="https://nc.mydomain.tld/index.php/s/gqEbGdDSGE7ZkbN"
# DL_from_NC
wget -O "DL_from_NC.sh" "$initSetupDL/download?path=&files=DL_from_NC.sh"
source DL_from_NC.sh
# START OF SCRIPTS
systemctl enable --now qemu-guest-agent.service
# Setup Scripts
DL_from_NC Portal_SSO_init.sh
yes | bash ./Portal_SSO_init.sh -x
rm ./Portal_SSO_init.sh
DL_from_NC Portal_SSO_API.sh
yes | bash ./Portal_SSO_API.sh -x
rm ./Portal_SSO_API.sh
DL_from_NC Portal_SSO_design.sh
yes | bash ./Portal_SSO_design.sh -x
rm ./Portal_SSO_design.sh
update
wget "$monitoring_cloudinit$myDOMAIN PORTAL SSO DONE"
runcmd:
- bash /root/init_script.sh
package_update: true
packages:
- qemu-guest-agent
```
Now I need to move to proxmox and smh need to reuse the same logic to deploy VMs.
I need it to be possible to deploy vm's with my cloud-init data as I used before. not just passign a username & password but variables and scripts via CLI.
# nice to have:
Even greater would be if someone has a CLI which works using the API and smh already includes some logic to distribute the VMs accordingly to the current usage of ressources of hosts in a cluster
this is how I passed data using cloudinit "user-data" as a .yaml file before:
```
#cloud-config
users:
- name: adminuser
sudo: ALL=(ALL) NOPASSWD:ALL
groups: sudo
shell: /bin/bash
chpasswd:
list: |
root:myPW
adminuser:myPW
expire: False
ssh_pwauth: true
disable_root: false
write_files:
- path: /root/init_script.sh
permissions: '0755'
content: |
#!/bin/bash
# Variables
timedatectl set-timezone Europe/Amsterdam
export myDOMAIN="mydomain.tld"
export myUSERCOUNT="100"
export CloudFlareAPITOKEN="myCloudFlareAPITOKEN"
# custom colors
export AK_ACCENT_NEW="#76b728"
# Monitoring & initSetupDL
export monitoring_cloudinit="https://monitor.mydomain.tld/api/push/WM9XqoCVyX?status=up&msg="
export initSetupDL="https://nc.mydomain.tld/index.php/s/gqEbGdDSGE7ZkbN"
# DL_from_NC
wget -O "DL_from_NC.sh" "$initSetupDL/download?path=&files=DL_from_NC.sh"
source DL_from_NC.sh
# START OF SCRIPTS
systemctl enable --now qemu-guest-agent.service
# Setup Scripts
DL_from_NC Portal_SSO_init.sh
yes | bash ./Portal_SSO_init.sh -x
rm ./Portal_SSO_init.sh
DL_from_NC Portal_SSO_API.sh
yes | bash ./Portal_SSO_API.sh -x
rm ./Portal_SSO_API.sh
DL_from_NC Portal_SSO_design.sh
yes | bash ./Portal_SSO_design.sh -x
rm ./Portal_SSO_design.sh
update
wget "$monitoring_cloudinit$myDOMAIN PORTAL SSO DONE"
runcmd:
- bash /root/init_script.sh
package_update: true
packages:
- qemu-guest-agent
```