You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.8 KiB

  1. #cloud-config
  2. %{ if ceph_partition_size > 0 || node_local_partition_size > 0}
  3. bootcmd:
  4. - [ cloud-init-per, once, move-second-header, sgdisk, --move-second-header, /dev/vda ]
  5. %{ if node_local_partition_size > 0 }
  6. # Create partition for node local storage
  7. - [ cloud-init-per, once, create-node-local-part, parted, --script, /dev/vda, 'mkpart extended ext4 ${root_partition_size}GB %{ if ceph_partition_size == 0 }-1%{ else }${root_partition_size + node_local_partition_size}GB%{ endif }' ]
  8. - [ cloud-init-per, once, create-fs-node-local-part, mkfs.ext4, /dev/vda2 ]
  9. %{ endif }
  10. %{ if ceph_partition_size > 0 }
  11. # Create partition for rook to use for ceph
  12. - [ cloud-init-per, once, create-ceph-part, parted, --script, /dev/vda, 'mkpart extended ${root_partition_size + node_local_partition_size}GB -1' ]
  13. %{ endif }
  14. %{ endif }
  15. ssh_authorized_keys:
  16. %{ for ssh_public_key in ssh_public_keys ~}
  17. - ${ssh_public_key}
  18. %{ endfor ~}
  19. write_files:
  20. - path: /etc/netplan/eth1.yaml
  21. content: |
  22. network:
  23. version: 2
  24. ethernets:
  25. eth1:
  26. dhcp4: true
  27. %{ if node_type == "worker" }
  28. # TODO: When a VM is seen as healthy and is added to the EIP loadbalancer
  29. # pool it no longer can send traffic back to itself via the EIP IP
  30. # address.
  31. # Remove this if it ever gets solved.
  32. - path: /etc/netplan/20-eip-fix.yaml
  33. content: |
  34. network:
  35. version: 2
  36. ethernets:
  37. "lo:0":
  38. match:
  39. name: lo
  40. dhcp4: false
  41. addresses:
  42. - ${eip_ip_address}/32
  43. %{ endif }
  44. runcmd:
  45. - netplan apply
  46. %{ if node_local_partition_size > 0 }
  47. - mkdir -p /mnt/disks/node-local-storage
  48. - chown nobody:nogroup /mnt/disks/node-local-storage
  49. - mount /dev/vda2 /mnt/disks/node-local-storage
  50. %{ endif }