mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-opentofu-private.git
synced 2025-10-27 15:53:06 +00:00
Merge pull request 'Update proxmox.tf' (#118) from fenix-admin into main
Reviewed-on: fenix-gitea-admin/iac-teste#118
This commit is contained in:
41
proxmox.tf
41
proxmox.tf
@ -15,7 +15,6 @@ provider "proxmox" {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resource "proxmox_virtual_environment_download_file" "latest_ubunto_cloud_img" {
|
||||
content_type = "iso"
|
||||
datastore_id = "local"
|
||||
@ -24,9 +23,36 @@ resource "proxmox_virtual_environment_download_file" "latest_ubunto_cloud_img" {
|
||||
file_name = "jammyservercloudimgamd64.img"
|
||||
}
|
||||
|
||||
resource "proxmox_virtual_environment_file" "cloud_init_yaml" {
|
||||
node_name = "fenix"
|
||||
datastore_id = "local"
|
||||
content_type = "cloud-init"
|
||||
file_name = "cloud-init-qga.yaml"
|
||||
|
||||
content = <<EOF
|
||||
#cloud-config
|
||||
users:
|
||||
- name: testeuser
|
||||
plain_text_passwd: testepassword
|
||||
lock_passwd: false
|
||||
shell: /bin/bash
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
|
||||
packages:
|
||||
- qemu-guest-agent
|
||||
|
||||
runcmd:
|
||||
- systemctl enable qemu-guest-agent
|
||||
- systemctl start qemu-guest-agent
|
||||
|
||||
ssh_pwauth: true
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
resource "proxmox_virtual_environment_vm" "proxmox-kubernetes-VM-template" {
|
||||
|
||||
depends_on = [proxmox_virtual_environment_download_file.latest_ubunto_cloud_img]
|
||||
depends_on = [proxmox_virtual_environment_download_file.latest_ubunto_cloud_img, proxmox_virtual_environment_file.cloud_init_yaml]
|
||||
name = "proxmox-kubernetes-VM-template"
|
||||
node_name = "fenix"
|
||||
vm_id = 1002
|
||||
@ -76,16 +102,7 @@ initialization {
|
||||
address = "dhcp" # IP estático + máscara de rede
|
||||
}
|
||||
}
|
||||
user_account {
|
||||
password = "testepassword"
|
||||
username = "testeuser"
|
||||
}
|
||||
bootcmd = [
|
||||
"apt-get update",
|
||||
"apt-get install -y qemu-guest-agent",
|
||||
"systemctl enable qemu-guest-agent",
|
||||
"systemctl start qemu-guest-agent"
|
||||
]
|
||||
user_data_file_id = proxmox_virtual_environment_file.cloud_init_yaml.id
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user