Compare commits

..

13 Commits

Author SHA1 Message Date
b3afe77bc0 output name and id to file 2025-10-18 20:29:22 +00:00
ef8ad56273 output test basic 2025-10-18 15:15:31 -04:00
344cb8a398 fixing console 2025-10-18 13:01:44 -04:00
d2ba0f5b9a Working? 2025-10-18 12:53:10 -04:00
440cd09734 attempt idk a lot 2025-10-18 12:08:50 -04:00
92e773faf4 Help me I am drowning 2025-10-18 12:07:59 -04:00
da522ad02e testing local container 2025-10-18 12:06:42 -04:00
768b778c69 Fixed Volume ID 2025-10-18 11:01:56 -04:00
d534503c54 Testing First Deployment 2025-10-18 10:48:44 -04:00
ac3a7b5681 Fix var 2025-10-18 10:11:31 -04:00
843de2f9a2 Attempt 2 lol 2025-10-18 10:10:33 -04:00
ec79acd448 All changes? 2025-10-18 10:09:02 -04:00
e824649729 Step one attempt 2025-10-18 10:08:12 -04:00
6 changed files with 100 additions and 1 deletions

1
Notes
View File

@@ -1 +0,0 @@
Hey Friends

32
Notes.txt Normal file
View File

@@ -0,0 +1,32 @@
#Hey Friends
# Starting with installing terraform on my ansible box.
wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform
# I dont want this to be in bash. but oh well
#starting with this github
https://github.com/Telmate/terraform-provider-proxmox/blob/master/docs/index.md
#I am on Proxmox 8 so starting off there.
pveum role add TerraformProv -privs "Datastore.AllocateSpace Datastore.AllocateTemplate Datastore.Audit Pool.Allocate Sys.Audit Sys.Console Sys.Modify VM.Allocate VM.Audit VM.Clone VM.Config.CDROM VM.Config.Cloudinit VM.Config.CPU VM.Config.Disk VM.Config.HWType VM.Config.Memory VM.Config.Network VM.Config.Options VM.Monitor VM.Migrate VM.PowerMgmt SDN.Use"
pveum user add terraform-prov@pve --password <in 1password>
pveum aclmod / -user terraform-prov@pve -role TerraformProv
pveum user token add terraform-prov@pve terraform-token --expire $(date -d 2025-10-24T23:59:59 +%s) --privsep false
#Nice this worked
# if update to 9 later
pveum role modify TerraformProv -privs "Datastore.AllocateSpace Datastore.AllocateTemplate Datastore.Audit Pool.Allocate Sys.Audit Sys.Console Sys.Modify VM.Allocate VM.Audit VM.Clone VM.Config.CDROM VM.Config.Cloudinit VM.Config.CPU VM.Config.Disk VM.Config.HWType VM.Config.Memory VM.Config.Network VM.Config.Options VM.Migrate VM.PowerMgmt SDN.Use"
#If I hate this
pveum role list
pveum role delete <uid>
pveum user delete <uid>
#I had to set the mapall user : root and mapall group : wheel in truenas. but then it worked!
pvesm path "nfs_Vulnerable:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst"

1
homelab_pub Normal file
View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJo337iE4+Ry7T65Ey+2QQ9aRaGxP7zzLtMV+hBPyA59 eddsa-key-20250525

4
outputs.tf Normal file
View File

@@ -0,0 +1,4 @@
output "proxmox" {
description="I am doing my Best"
value = basic.id
}

30
provider.tf Normal file
View File

@@ -0,0 +1,30 @@
terraform {
required_version = ">= 1.13.0"
required_providers{
proxmox = {
source = "telmate/proxmox"
}
ansible = {
source = "ansible/ansible"
}
}
}
variable "proxmox_api_url" {
type = string
}
variable "proxmox_api_token_id" {
type = string
sensitive = true
}
variable "proxmox_api_token_secret" {
type = string
sensitive = true
}
provider "proxmox" {
pm_api_url = var.proxmox_api_url
pm_api_token_id = var.proxmox_api_token_id
pm_api_token_secret = var.proxmox_api_token_secret
}

33
srv-debianlxc.tf Normal file
View File

@@ -0,0 +1,33 @@
resource "proxmox_lxc" "basic" {
target_node = "pve"
hostname = "lxc-basic"
ostemplate = "nfs_Vulnerable:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst"
password = "BasicLXCContainer"
unprivileged = true
description = "Nice"
features {
nesting = true
}
ssh_public_keys = <<-EOT
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJo337iE4+Ry7T65Ey+2QQ9aRaGxP7zzLtMV+hBPyA59 eddsa-key-20250525
EOT
// Terraform will crash without rootfs defined
rootfs {
storage = "nfs_Protected"
size = "8G"
}
network {
name = "eth0"
bridge = "vmbr0"
ip = "dhcp"
}
}
resource "local_file" "Ans_inv" {
content = <<-DOC
hostname: ${proxmox_lxc.basic.hostname}
id: ${proxmox_lxc.basic.id}
DOC
filename = "${path.module}/output.txt"
}