44 lines
904 B
HCL
44 lines
904 B
HCL
resource "proxmox_virtual_environment_file" "common_cloud_init" {
|
|
content_type = "snippets"
|
|
datastore_id = var.proxmox_image_storage
|
|
node_name = "pve"
|
|
|
|
source_raw {
|
|
data = <<EOF
|
|
#cloud-config
|
|
chpasswd:
|
|
list: |
|
|
ubuntu:ubuntu
|
|
${var.username}:${var.username}
|
|
expire: false
|
|
packages:
|
|
- qemu-guest-agent
|
|
- nfs-common
|
|
- avahi-daemon
|
|
timezone: America/Vancouver
|
|
|
|
users:
|
|
- default
|
|
- name: ubuntu
|
|
groups: sudo
|
|
shell: /bin/bash
|
|
ssh-authorized-keys:
|
|
- ${trimspace(file(var.ssh_public_key_file))}
|
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
- name: ${var.username}
|
|
groups: sudo
|
|
shell: /bin/bash
|
|
ssh_import_id:
|
|
- ${var.ssh_import_id}
|
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
|
|
power_state:
|
|
delay: now
|
|
mode: reboot
|
|
message: Rebooting after cloud-init completion
|
|
condition: true
|
|
EOF
|
|
file_name = "common-cloud-init.cloud-config.yaml"
|
|
}
|
|
}
|