aboutsummaryrefslogtreecommitdiff
path: root/opentofu
diff options
context:
space:
mode:
authorclyhtsuriva <aimeric@adjutor.xyz>2025-03-04 20:09:31 +0100
committerclyhtsuriva <aimeric@adjutor.xyz>2025-03-04 20:09:31 +0100
commite02cf37430f92859a0f4b644af6d2665847c3997 (patch)
treeb12dbed1e7d6d0dea1d365f23bcec2f0f9cf3337 /opentofu
parent0182fe51736e7610d4a63fe6767d08ffe5c5938c (diff)
opentofu: Incr. nb of k3s workers + remove ansible custom module
Diffstat (limited to 'opentofu')
-rw-r--r--opentofu/main.tf2
-rw-r--r--opentofu/modules/ansible_provisioner/main.tf15
-rw-r--r--opentofu/modules/ansible_provisioner/variables.tf26
-rw-r--r--opentofu/modules/ansible_provisioner/versions.tf11
-rw-r--r--opentofu/terraform.tfvars1
-rw-r--r--opentofu/variables.tf5
6 files changed, 1 insertions, 59 deletions
diff --git a/opentofu/main.tf b/opentofu/main.tf
index 6fa477c..5cc3adc 100644
--- a/opentofu/main.tf
+++ b/opentofu/main.tf
@@ -107,7 +107,7 @@ resource "proxmox_virtual_environment_vm" "k3s_master" {
# Worker Nodes
resource "proxmox_virtual_environment_vm" "k3s_worker" {
- count = 1
+ count = 3
name = "k3s-worker-${count.index}"
node_name = var.proxmox_node
tags = ["debian", "k8s", "k3s_worker"]
diff --git a/opentofu/modules/ansible_provisioner/main.tf b/opentofu/modules/ansible_provisioner/main.tf
deleted file mode 100644
index b836213..0000000
--- a/opentofu/modules/ansible_provisioner/main.tf
+++ /dev/null
@@ -1,15 +0,0 @@
-resource "null_resource" "ansible_provisioner" {
- triggers = {
- ip_or_inventory = coalesce(var.vm_ip, var.inventory_file_path) # Choose based on what is provided
- }
-
- provisioner "local-exec" {
- command = <<-EOT
- ANSIBLE_HOST_KEY_CHECKING=False ANSIBLE_CONFIG=${path.root}/../ansible/ansible.cfg ansible-playbook -b -v \
- -i ${var.inventory_file_path != null ? var.inventory_file_path : "${var.vm_ip},"} \
- -u ${var.vm_username} \
- --private-key ${var.ssh_private_key_path} \
- ${var.ansible_playbook_path}
- EOT
- }
-}
diff --git a/opentofu/modules/ansible_provisioner/variables.tf b/opentofu/modules/ansible_provisioner/variables.tf
deleted file mode 100644
index 0d15d01..0000000
--- a/opentofu/modules/ansible_provisioner/variables.tf
+++ /dev/null
@@ -1,26 +0,0 @@
-variable "vm_ip" {
- type = string
- default = null
- description = "The IP address of the VM to provision. Either this or `inventory_file_path` must be provided."
-}
-
-variable "inventory_file_path" {
- type = string
- default = null
- description = "The path to the Ansible inventory file. Either this or `vm_ip` must be provided."
-}
-
-variable "vm_username" {
- type = string
- description = "The username to use for SSH access to the VM."
-}
-
-variable "ssh_private_key_path" {
- type = string
- description = "The path to the private SSH key for accessing the VM."
-}
-
-variable "ansible_playbook_path" {
- type = string
- description = "The path to the Ansible playbook to execute."
-}
diff --git a/opentofu/modules/ansible_provisioner/versions.tf b/opentofu/modules/ansible_provisioner/versions.tf
deleted file mode 100644
index d1135ae..0000000
--- a/opentofu/modules/ansible_provisioner/versions.tf
+++ /dev/null
@@ -1,11 +0,0 @@
-terraform {
- required_version = ">= 1.8.0"
-
- required_providers {
- null = {
- source = "hashicorp/null"
- version = ">= 0.0.0"
- }
- }
-}
-
diff --git a/opentofu/terraform.tfvars b/opentofu/terraform.tfvars
index ba8756b..a4f8a13 100644
--- a/opentofu/terraform.tfvars
+++ b/opentofu/terraform.tfvars
@@ -3,5 +3,4 @@ proxmox_node = "pve"
debian_server_bookworm_packer_image_id = "999"
ubuntu_server_noble_packer_image_id = "998"
vm_username = "mas"
-ssh_private_key_path = "~/.ssh/id_ecdsa"
ssh_public_key = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCtB9NZgJMVovVR4foT0OOV9GdHeHZoPtK1TGko2W4wli/reKjpUYBhlSPWbaWD9WUbl0RRqdzkODy1fB001zxs= mas@TMV2"
diff --git a/opentofu/variables.tf b/opentofu/variables.tf
index 30e82bf..5303878 100644
--- a/opentofu/variables.tf
+++ b/opentofu/variables.tf
@@ -26,11 +26,6 @@ variable "vm_username" {
default = "mas"
}
-variable "ssh_private_key_path" {
- description = "Path to the SSH private key for Ansible"
- type = string
-}
-
variable "ssh_public_key" {
type = string
sensitive = true