Skip to content

Instantly share code, notes, and snippets.

@zhangjiankun97
Created April 10, 2020 14:47
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save zhangjiankun97/7f2699c24c65244b1691d3684d357eb0 to your computer and use it in GitHub Desktop.
Save zhangjiankun97/7f2699c24c65244b1691d3684d357eb0 to your computer and use it in GitHub Desktop.
Create VM and install rancheros by cloud-init on Proxmox VE.
#cloud-config
rancher:
network:
interfaces:
eth0:
address: 192.168.1.20/24
gateway: 192.168.1.1
mtu: 1500
dhcp: false
dns:
nameservers:
- 114.114.114.114
- 8.8.8.8
write_files:
- path: /home/rancher/install.yml
permissions: "777"
content: |
#cloud-config
hostname: rancher-server
rancher:
console: ubuntu
network:
interfaces:
eth0:
address: 192.168.1.20/24
gateway: 192.168.1.1
mtu: 1500
dhcp: false
dns:
nameservers:
- 114.114.114.114
- 8.8.8.8
ssh_authorized_keys:
- ssh-rsa AAAA****
runcmd:
- echo Y | sudo ros install -c /home/rancher/install.yml -d /dev/sda
VMID = 9000
qm create ${VMID} --name rancheros-cloud-image --memory 4096 --balloon 0 --net0 virtio,bridge=vmbr0 --cores 4 --sockets 1 --cpu cputype=host --kvm 1 --numa 1
qm set ${VMID} --ide2 local:iso/rancheros-proxmoxve.iso,media=cdrom
qm set ${VMID} --scsihw virtio-scsi-pci --scsi0 local-lvm:32
qm set ${VMID} --boot cdn --bootdisk scsi0
qm set ${VMID} --agent 1
#Cloud INIT
qm set ${VMID} --ide0 local-lvm:cloudinit
# location of config.yml is /var/liv/vz/snippets/config.yml
qm set ${VMID} --cicustom "user=local:snippets/config.yml" --citype configdrive2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment