Compare commits
26 Commits
8c793d3d59
...
main
Author | SHA1 | Date | |
---|---|---|---|
ef0e5bf8f2 | |||
89be2412ef | |||
2f60387d70 | |||
b73837c028 | |||
3a991010d5 | |||
4d92a926be | |||
c524868cf5 | |||
a78860c3b8 | |||
e9f084443d | |||
e17e6be329 | |||
54317c0a1c | |||
12807ca973 | |||
fa52fdeed9 | |||
bfd5db44a0 | |||
b13a0b4ed9 | |||
e45eb9de69 | |||
db31372abb | |||
bc64652310 | |||
e6d453fce3 | |||
99c3183cb4 | |||
62f3ac22b2 | |||
af91955f47 | |||
bc19a7638b | |||
c3db663e9e | |||
995e99c1e6 | |||
de457e8e38 |
21
README.md
21
README.md
@@ -1,3 +1,20 @@
|
||||
# Homelab
|
||||
# 🧪 Homelab
|
||||
|
||||
Hello world !
|
||||
> ⚠️ **Work in Progress** – This repository is actively evolving as I automate and expand my homelab.
|
||||
|
||||
Welcome to my homelab repository! This is where I manage and document the infrastructure powering my personal lab environment using modern DevOps tools and best practices.
|
||||
|
||||
## 🚀 Goals
|
||||
|
||||
- Automate VM and infrastructure deployment with **Terraform**
|
||||
- Configure systems and services using **Ansible**
|
||||
- Deploy and manage Kubernetes with **Flux CD** using a **GitOps** approach
|
||||
- Keep everything **declarative**, **reproducible**, and **version-controlled**
|
||||
|
||||
## 📌 Notes
|
||||
|
||||
This repository is intended for **educational and experimental purposes**. Feel free to explore, fork, and adapt ideas for your own homelab setup.
|
||||
|
||||
---
|
||||
|
||||
Stay tuned — more coming soon! 🚧
|
||||
|
5
ansible/inventories/terraform.yml
Normal file
5
ansible/inventories/terraform.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
plugin: cloud.terraform.terraform_provider
|
||||
project_path:
|
||||
- /home/vez/homelab/terraform/projects/terransible
|
||||
state_file: terraform.tfstate.d/lab/terraform.tfstate
|
31
ansible/playbooks/deploy_tf.yml
Normal file
31
ansible/playbooks/deploy_tf.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
- name: Deploy a Terraform infrastructure
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- ansible.builtin.import_role:
|
||||
name: terraform_vm
|
||||
vars:
|
||||
terraform_vm_state: "{{ state | default(omit) }}"
|
||||
terraform_vm_project_path: /home/vez/homelab/terraform/projects/terransible
|
||||
terraform_vars_vm_env: "{{ env | default('lab')}}"
|
||||
terraform_vars_vm_tags:
|
||||
- "{{ env | default('lab')}}"
|
||||
terraform_vars_multi_node_deployment: "{{ multi_node_deployment | default(true) }}"
|
||||
terraform_vars_target_node: "{{ target_node | default(omit) }}"
|
||||
terraform_vars_vm_attr: {"master": { "ram": 2048, "cpu": 2, "vlan": 66 }, "worker": { "ram": 1024, "cpu": 1, "vlan": 66 }}
|
||||
|
||||
- name: Ping
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Ping all the hosts
|
||||
ansible.builtin.ping:
|
||||
|
||||
delegate_to:
|
||||
- name: Ping the master
|
||||
ansible.builtin.ping:
|
||||
when: inventory_hostname in groups['master']
|
||||
|
||||
- name: Ping the worker
|
||||
ansible.builtin.ping:
|
||||
when: inventory_hostname in groups['worker']
|
3
ansible/roles/terraform_vm/defaults/main.yml
Normal file
3
ansible/roles/terraform_vm/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
terraform_ansible_inventory: /home/vez/homelab/ansible/inventories/terraform.yml
|
||||
terraform_vm_state: present
|
25
ansible/roles/terraform_vm/tasks/main.yml
Normal file
25
ansible/roles/terraform_vm/tasks/main.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Deploy a Terraform infrastructure
|
||||
delegate_to: localhost
|
||||
cloud.terraform.terraform:
|
||||
project_path: "{{ terraform_vm_project_path }}"
|
||||
state: "{{ terraform_vm_state }}"
|
||||
workspace: "{{ terraform_vars_vm_env | default(omit)}}"
|
||||
parallelism: 3
|
||||
complex_vars: true
|
||||
variables:
|
||||
multi_node_deployment: "{{ terraform_vars_multi_node_deployment | default(omit)}}"
|
||||
target_node: "{{ terraform_vars_target_node | default(omit)}}"
|
||||
vm_attr: "{{ terraform_vars_vm_attr | default(omit)}}"
|
||||
vm_env: "{{ terraform_vars_vm_env | default(omit)}}"
|
||||
vm_tags: "{{ terraform_vars_vm_tags | default(omit)}}"
|
||||
|
||||
- name: Update Terraform workspace path
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ terraform_ansible_inventory }}"
|
||||
regexp: '^state_file:.*tfstate$'
|
||||
line: "state_file: terraform.tfstate.d/{{ terraform_vars_vm_env }}/terraform.tfstate"
|
||||
when: terraform_vars_vm_env is defined
|
||||
|
||||
- name: Refresh inventory
|
||||
ansible.builtin.meta: refresh_inventory
|
@@ -1,93 +1,108 @@
|
||||
# Retrieve VM templates available in Proxmox that match the specified name
|
||||
data "proxmox_virtual_environment_vms" "template" {
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["${var.vm_template}"]
|
||||
values = ["${var.vm_template}"] # The name of the template to clone from
|
||||
}
|
||||
}
|
||||
|
||||
# Create a cloud-init configuration file as a Proxmox snippet
|
||||
resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||
content_type = "snippets"
|
||||
datastore_id = "local"
|
||||
node_name = var.node_name
|
||||
content_type = "snippets" # Cloud-init files are stored as snippets in Proxmox
|
||||
datastore_id = "local" # Local datastore used to store the snippet
|
||||
node_name = var.node_name # The Proxmox node where the file will be uploaded
|
||||
|
||||
source_raw {
|
||||
file_name = "${var.vm_name}.cloud-config.yaml"
|
||||
file_name = "${var.vm_name}.cloud-config.yaml" # The name of the snippet file
|
||||
data = <<-EOF
|
||||
#cloud-config
|
||||
hostname: ${var.vm_name}
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
packages:
|
||||
- qemu-guest-agent
|
||||
- qemu-guest-agent # Ensures the guest agent is installed
|
||||
users:
|
||||
- default
|
||||
- name: ${var.vm_user}
|
||||
groups: sudo
|
||||
shell: /bin/bash
|
||||
ssh-authorized-keys:
|
||||
- "${var.vm_user_sshkey}"
|
||||
- "${var.vm_user_sshkey}" # Inject user's SSH key
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
runcmd:
|
||||
- systemctl enable qemu-guest-agent
|
||||
- reboot
|
||||
- reboot # Reboot the VM after provisioning
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
# Define and provision a new VM by cloning the template and applying initialization
|
||||
resource "proxmox_virtual_environment_vm" "vm" {
|
||||
name = var.vm_name
|
||||
node_name = var.node_name
|
||||
tags = var.vm_tags
|
||||
name = var.vm_name # VM name
|
||||
node_name = var.node_name # Proxmox node to deploy the VM
|
||||
tags = var.vm_tags # Optional VM tags for categorization
|
||||
|
||||
agent {
|
||||
enabled = true
|
||||
enabled = true # Enable the QEMU guest agent
|
||||
}
|
||||
stop_on_destroy = true
|
||||
|
||||
stop_on_destroy = true # Ensure VM is stopped gracefully when destroyed
|
||||
|
||||
clone {
|
||||
vm_id = data.proxmox_virtual_environment_vms.template.vms[0].vm_id
|
||||
node_name = data.proxmox_virtual_environment_vms.template.vms[0].node_name
|
||||
vm_id = data.proxmox_virtual_environment_vms.template.vms[0].vm_id # ID of the source template
|
||||
node_name = data.proxmox_virtual_environment_vms.template.vms[0].node_name # Node of the source template
|
||||
}
|
||||
bios = var.vm_bios
|
||||
machine = var.vm_machine
|
||||
|
||||
bios = var.vm_bios # BIOS type (e.g., seabios or ovmf)
|
||||
machine = var.vm_machine # Machine type (e.g., q35)
|
||||
|
||||
cpu {
|
||||
cores = var.vm_cpu
|
||||
type = "host"
|
||||
cores = var.vm_cpu # Number of CPU cores
|
||||
type = "host" # Use host CPU type for best compatibility/performance
|
||||
}
|
||||
|
||||
memory {
|
||||
dedicated = var.vm_ram
|
||||
dedicated = var.vm_ram # RAM in MB
|
||||
}
|
||||
|
||||
disk {
|
||||
datastore_id = var.node_datastore
|
||||
interface = "scsi0"
|
||||
size = 4
|
||||
datastore_id = var.node_datastore # Datastore to hold the disk
|
||||
interface = "scsi0" # Primary disk interface
|
||||
size = var.vm_disk_size # Disk size in GB
|
||||
}
|
||||
|
||||
initialization {
|
||||
user_data_file_id = proxmox_virtual_environment_file.cloud_config.id
|
||||
user_data_file_id = proxmox_virtual_environment_file.cloud_config.id # Link the cloud-init file
|
||||
datastore_id = var.node_datastore
|
||||
interface = "scsi1"
|
||||
interface = "scsi1" # Separate interface for cloud-init
|
||||
ip_config {
|
||||
ipv4 {
|
||||
address = "dhcp"
|
||||
address = "dhcp" # Get IP via DHCP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
network_device {
|
||||
bridge = "vmbr0"
|
||||
vlan_id = var.vm_vlan
|
||||
bridge = "vlan${var.vm_vlan}" # VNet used with VLAN ID
|
||||
}
|
||||
|
||||
operating_system {
|
||||
type = "l26"
|
||||
type = "l26" # Linux 2.6+ kernel
|
||||
}
|
||||
|
||||
vga {
|
||||
type = "std"
|
||||
type = "std" # Standard VGA type
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [
|
||||
ignore_changes = [ # Ignore initialization section after first depoloyment for idempotency
|
||||
initialization
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# Output the assigned IP address of the VM after provisioning
|
||||
output "vm_ip" {
|
||||
value = proxmox_virtual_environment_vm.vm.ipv4_addresses[1][0]
|
||||
value = proxmox_virtual_environment_vm.vm.ipv4_addresses[1][0] # Second network interface's first IP
|
||||
description = "VM IP"
|
||||
}
|
||||
|
||||
}
|
@@ -44,6 +44,12 @@ variable "vm_ram" {
|
||||
default = 2048
|
||||
}
|
||||
|
||||
variable "vm_disk_size" {
|
||||
description = "Size of the disk (GB) of the VM"
|
||||
type = number
|
||||
default = 10
|
||||
}
|
||||
|
||||
variable "vm_bios" {
|
||||
description = "Type of BIOS used for the VM"
|
||||
type = string
|
||||
|
@@ -19,7 +19,7 @@ locals {
|
||||
for node in data.proxmox_virtual_environment_nodes.pve_nodes.names : [
|
||||
for role, config in local.vm_attr : {
|
||||
node_name = node
|
||||
vm_name = "${role}-${node}"
|
||||
vm_name = "${node}-${role}"
|
||||
vm_cpu = config.cpu
|
||||
vm_ram = config.ram
|
||||
vm_vlan = config.vlan
|
||||
|
@@ -7,4 +7,4 @@ variable "proxmox_api_token" {
|
||||
description = "Proxmox API token"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
}
|
108
terraform/projects/simple-vm/main.tf
Normal file
108
terraform/projects/simple-vm/main.tf
Normal file
@@ -0,0 +1,108 @@
|
||||
# Retrieve VM templates available in Proxmox that match the specified name
|
||||
data "proxmox_virtual_environment_vms" "template" {
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["${var.vm_template}"] # The name of the template to clone from
|
||||
}
|
||||
}
|
||||
|
||||
# Create a cloud-init configuration file as a Proxmox snippet
|
||||
resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||
content_type = "snippets" # Cloud-init files are stored as snippets in Proxmox
|
||||
datastore_id = "local" # Local datastore used to store the snippet
|
||||
node_name = var.node_name # The Proxmox node where the file will be uploaded
|
||||
|
||||
source_raw {
|
||||
file_name = "vm.cloud-config.yaml" # The name of the snippet file
|
||||
data = <<-EOF
|
||||
#cloud-config
|
||||
hostname: ${var.vm_name}
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
packages:
|
||||
- qemu-guest-agent # Ensures the guest agent is installed
|
||||
users:
|
||||
- default
|
||||
- name: ${var.vm_user}
|
||||
groups: sudo
|
||||
shell: /bin/bash
|
||||
ssh-authorized-keys:
|
||||
- "${var.vm_user_sshkey}" # Inject user's SSH key
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
runcmd:
|
||||
- systemctl enable qemu-guest-agent
|
||||
- reboot # Reboot the VM after provisioning
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
# Define and provision a new VM by cloning the template and applying initialization
|
||||
resource "proxmox_virtual_environment_vm" "vm" {
|
||||
name = var.vm_name # VM name
|
||||
node_name = var.node_name # Proxmox node to deploy the VM
|
||||
tags = var.vm_tags # Optional VM tags for categorization
|
||||
|
||||
agent {
|
||||
enabled = true # Enable the QEMU guest agent
|
||||
}
|
||||
|
||||
stop_on_destroy = true # Ensure VM is stopped gracefully when destroyed
|
||||
|
||||
clone {
|
||||
vm_id = data.proxmox_virtual_environment_vms.template.vms[0].vm_id # ID of the source template
|
||||
node_name = data.proxmox_virtual_environment_vms.template.vms[0].node_name # Node of the source template
|
||||
}
|
||||
|
||||
bios = var.vm_bios # BIOS type (e.g., seabios or ovmf)
|
||||
machine = var.vm_machine # Machine type (e.g., q35)
|
||||
|
||||
cpu {
|
||||
cores = var.vm_cpu # Number of CPU cores
|
||||
type = "host" # Use host CPU type for best compatibility/performance
|
||||
}
|
||||
|
||||
memory {
|
||||
dedicated = var.vm_ram # RAM in MB
|
||||
}
|
||||
|
||||
disk {
|
||||
datastore_id = var.node_datastore # Datastore to hold the disk
|
||||
interface = "scsi0" # Primary disk interface
|
||||
size = 4 # Disk size in GB
|
||||
}
|
||||
|
||||
initialization {
|
||||
user_data_file_id = proxmox_virtual_environment_file.cloud_config.id # Link the cloud-init file
|
||||
datastore_id = var.node_datastore
|
||||
interface = "scsi1" # Separate interface for cloud-init
|
||||
ip_config {
|
||||
ipv4 {
|
||||
address = "dhcp" # Get IP via DHCP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
network_device {
|
||||
bridge = "vlan${var.vm_vlan}" # VNet used with VLAN ID
|
||||
}
|
||||
|
||||
operating_system {
|
||||
type = "l26" # Linux 2.6+ kernel
|
||||
}
|
||||
|
||||
vga {
|
||||
type = "std" # Standard VGA type
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [ # Ignore initialization section after first depoloyment for idempotency
|
||||
initialization
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# Output the assigned IP address of the VM after provisioning
|
||||
output "vm_ip" {
|
||||
value = proxmox_virtual_environment_vm.vm.ipv4_addresses[1][0] # Second network interface's first IP
|
||||
description = "VM IP"
|
||||
}
|
22
terraform/projects/simple-vm/provider.tf
Normal file
22
terraform/projects/simple-vm/provider.tf
Normal file
@@ -0,0 +1,22 @@
|
||||
# Define the required Terraform provider block
|
||||
terraform {
|
||||
required_providers {
|
||||
proxmox = {
|
||||
source = "bpg/proxmox" # Use the community Proxmox provider from the bpg namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Configure the Proxmox provider with API and SSH access
|
||||
provider "proxmox" {
|
||||
endpoint = var.proxmox_endpoint # Proxmox API URL (e.g., https://proxmox.local:8006/api2/json)
|
||||
api_token = var.proxmox_api_token # API token for authentication (should have appropriate permissions)
|
||||
insecure = false # Reject self-signed or invalid TLS certificates (set to true only in trusted/test environments)
|
||||
|
||||
# Optional SSH settings used for VM customization via SSH
|
||||
ssh {
|
||||
agent = false # Do not use the local SSH agent; use key file instead
|
||||
private_key = file("~/.ssh/id_ed25519") # Load SSH private key from the local file system
|
||||
username = "root" # SSH username for connecting to the Proxmox host
|
||||
}
|
||||
}
|
5
terraform/projects/simple-vm/terraform.tfvars
Normal file
5
terraform/projects/simple-vm/terraform.tfvars
Normal file
@@ -0,0 +1,5 @@
|
||||
node_name = "zenith" # Name of the Proxmox node where the VM will be deployed
|
||||
vm_name = "zenith-vm" # Desired name for the new virtual machine
|
||||
vm_cpu = 2 # Number of CPU cores to allocate to the VM
|
||||
vm_ram = 2048 # Amount of RAM in MB (2 GB)
|
||||
vm_vlan = 66 # VLAN ID for network segmentation
|
80
terraform/projects/simple-vm/variables.tf
Normal file
80
terraform/projects/simple-vm/variables.tf
Normal file
@@ -0,0 +1,80 @@
|
||||
variable "proxmox_endpoint" {
|
||||
description = "Proxmox URL endpoint"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "proxmox_api_token" {
|
||||
description = "Proxmox API token"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "node_name" {
|
||||
description = "Proxmox host for the VM"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "node_datastore" {
|
||||
description = "Datastore used for VM storage"
|
||||
type = string
|
||||
default = "ceph-workload"
|
||||
}
|
||||
|
||||
variable "vm_template" {
|
||||
description = "Template of the VM"
|
||||
type = string
|
||||
default = "ubuntu-cloud"
|
||||
}
|
||||
|
||||
variable "vm_name" {
|
||||
description = "Hostname of the VM"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "vm_user" {
|
||||
description = "Admin user of the VM"
|
||||
type = string
|
||||
default = "vez"
|
||||
}
|
||||
|
||||
variable "vm_user_sshkey" {
|
||||
description = "Admin user SSH key of the VM"
|
||||
type = string
|
||||
default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID62LmYRu1rDUha3timAIcA39LtcIOny1iAgFLnxoBxm vez@bastion"
|
||||
}
|
||||
|
||||
variable "vm_cpu" {
|
||||
description = "Number of CPU cores of the VM"
|
||||
type = number
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "vm_ram" {
|
||||
description = "Number of RAM (MB) of the VM"
|
||||
type = number
|
||||
default = 2048
|
||||
}
|
||||
|
||||
variable "vm_bios" {
|
||||
description = "Type of BIOS used for the VM"
|
||||
type = string
|
||||
default = "ovmf"
|
||||
}
|
||||
|
||||
variable "vm_machine" {
|
||||
description = "Type of machine used for the VM"
|
||||
type = string
|
||||
default = "q35"
|
||||
}
|
||||
|
||||
variable "vm_vlan" {
|
||||
description = "VLAN of the VM"
|
||||
type = number
|
||||
default = 66
|
||||
}
|
||||
|
||||
variable "vm_tags" {
|
||||
description = "Tags for the VM"
|
||||
type = list(any)
|
||||
default = ["test"]
|
||||
}
|
63
terraform/projects/terransible/main.tf
Normal file
63
terraform/projects/terransible/main.tf
Normal file
@@ -0,0 +1,63 @@
|
||||
module "pve_vm" {
|
||||
source = "../../modules/pve_vm"
|
||||
for_each = local.vm_list
|
||||
node_name = each.value.node_name
|
||||
vm_name = each.value.vm_name
|
||||
vm_cpu = each.value.vm_cpu
|
||||
vm_ram = each.value.vm_ram
|
||||
vm_vlan = each.value.vm_vlan
|
||||
vm_tags = var.vm_tags
|
||||
}
|
||||
|
||||
locals {
|
||||
all_nodes = data.proxmox_virtual_environment_nodes.pve_nodes.names
|
||||
|
||||
selected_nodes = var.multi_node_deployment == false ? [var.target_node] : local.all_nodes
|
||||
|
||||
env_digit_map = {
|
||||
"test" = 1
|
||||
"lab" = 2
|
||||
"dev" = 3
|
||||
"val" = 4
|
||||
"prod" = 5
|
||||
}
|
||||
|
||||
env_digit = lookup(local.env_digit_map, var.vm_env, 0)
|
||||
|
||||
vm_list = {
|
||||
for vm in flatten([
|
||||
for node in local.selected_nodes : [
|
||||
for role, config in var.vm_attr : {
|
||||
node_name = node
|
||||
vm_name = "${role}-${var.vm_env}-${node}"
|
||||
vm_name = "kub-${substr(role, 0, 1)}${local.env_digit}${substr(node, 0, 1)}"
|
||||
vm_cpu = config.cpu
|
||||
vm_ram = config.ram
|
||||
vm_vlan = config.vlan
|
||||
vm_role = role
|
||||
}
|
||||
]
|
||||
]) : vm.vm_name => vm
|
||||
}
|
||||
|
||||
roles = toset([for vm in local.vm_list : vm.vm_role])
|
||||
}
|
||||
|
||||
data "proxmox_virtual_environment_nodes" "pve_nodes" {}
|
||||
|
||||
output "vm_ip" {
|
||||
value = { for k, v in module.pve_vm : k => v.vm_ip }
|
||||
}
|
||||
|
||||
resource "ansible_group" "vm_groups" {
|
||||
for_each = local.roles
|
||||
name = each.key
|
||||
}
|
||||
resource "ansible_host" "vm_hosts" {
|
||||
for_each = module.pve_vm
|
||||
name = each.key
|
||||
variables = {
|
||||
ansible_host = each.value.vm_ip
|
||||
}
|
||||
groups = [local.vm_list[each.key].vm_role]
|
||||
}
|
21
terraform/projects/terransible/provider.tf
Normal file
21
terraform/projects/terransible/provider.tf
Normal file
@@ -0,0 +1,21 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
proxmox = {
|
||||
source = "bpg/proxmox"
|
||||
}
|
||||
ansible = {
|
||||
source = "ansible/ansible"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "proxmox" {
|
||||
endpoint = var.proxmox_endpoint
|
||||
api_token = var.proxmox_api_token
|
||||
insecure = false
|
||||
ssh {
|
||||
agent = false
|
||||
private_key = file("~/.ssh/id_ed25519")
|
||||
username = "root"
|
||||
}
|
||||
}
|
46
terraform/projects/terransible/variables.tf
Normal file
46
terraform/projects/terransible/variables.tf
Normal file
@@ -0,0 +1,46 @@
|
||||
variable "proxmox_endpoint" {
|
||||
description = "Proxmox URL endpoint"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "proxmox_api_token" {
|
||||
description = "Proxmox API token"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "multi_node_deployment" {
|
||||
description = "true : deploy VMs on each node, false : deploy only on a given node"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "target_node" {
|
||||
description = "Node which host the VM if multi_node_deployment = false"
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "vm_attr" {
|
||||
description = "VM attributes"
|
||||
type = map(object({
|
||||
ram = number
|
||||
cpu = number
|
||||
vlan = number
|
||||
}))
|
||||
default = {
|
||||
"vm" = { ram = 2048, cpu = 2, vlan = 66 }
|
||||
}
|
||||
}
|
||||
|
||||
variable "vm_env" {
|
||||
description = "VM environment"
|
||||
type = string
|
||||
default = "test"
|
||||
}
|
||||
|
||||
variable "vm_tags" {
|
||||
description = "Tags for the VM"
|
||||
type = list(any)
|
||||
default = ["test"]
|
||||
}
|
Reference in New Issue
Block a user