Code Monkey home page Code Monkey logo

terraform-proxmox's Introduction

Terraform-Proxmox

Overview

Automate the provisioning of virtual machines in proxmox using terraform

Prerequisites

  1. Proxmox Server

Resources

  1. Ubunutu Cloud Images
  2. Debian Cloud Images
  3. Terraform Proxmox Provider

Install libguestfs-tools

ssh root@proxmox-server

sudo apt update -y && sudo apt install libguestfs-tools -y

Download Ubuntu Cloud Image

wget https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img

# Change file extension of the image to .qcow2
mv ubuntu-22.04-minimal-cloudimg-amd64.img ubuntu-22.04.qcow2

Download Debian Cloud Image

wget https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-arm64.qcow2

Install qemu-guest-agent in the cloud image

virt-customize -a ubuntu-22.04.qcow2 --install qemu-guest-agent
qemu-img resize ubuntu-22.04.qcow2 32G
# or
virt-customize -a debian-11-generic-amd64.qcow2 --install qemu-guest-agent
qemu-img resize debian-11-generic-amd64.qcow2 32G

Create VM Template

qm create 900 --name "debian-11-cloudinit-template" --memory 2048 --cores 2 --net0 virtio,bridge=vmbr1
qm importdisk 900 debian-11-generic-amd64.qcow2 local-lvm
qm set 900 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-900-disk-0
qm set 900 --boot c --bootdisk scsi0
qm set 900 --ide2 local-lvm:cloudinit
qm set 900 --serial0 socket --vga serial0
qm set 900 --agent enabled=1

qm template 900

Getting Started

  • Create a local copy of credentials.example:
cp credentials.example credentials.auto.tfvars
  • Create an API token in proxmox and populate the necessary values in credentials.auto.tfvars
# Initialize the provider
terraform init

# Shows us what terraform plans on creating
terraform plan

# Deploy Resources
terraform apply -auto-approve

# Destroy Resoureces
terraform destroy

terraform-proxmox's People

Contributors

brandonw62 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.