This repository contains scripts and configuration files for creating a pre-configured Proxmox VM template using Packer and Ansible. The VM template is based on Debian 12 (Bookworm) and includes a variety of tools and configurations, such as Docker, Fish shell, and Starship prompt.
- Proxmox Virtual Environment (8.0.9)
- Packer (1.9.4)
- Ansible core (2.15.6)
I ran this on the same Proxmox host where the image was being created. It may or may not work from other remote proxmox nodes.
-
Clone this repository to your Proxmox host machine.
-
Navigate to the root directory of the project.
-
Customize the variables in the
prox.pkrvars.hcl.example
file according to your Proxmox environment and rename it toprox.pkrvars.hcl
. -
Run the
create_proxmox_vm_template.sh
script to generate a basic, pre-configured Proxmox VM template, which Packer will utilize as a bootstrap to create a finalized template image in step 5. This script downloads a Debian 12 image, customizes it, creates a VM, and converts it to a template.
chmod +x create_proxmox_vm_template.sh
./create_proxmox_vm_template.sh
- Run Packer to create the final VM template. Packer uses the
proxmox.pkr.hcl
configuration file and theplaybook.yml
Ansible playbook for provisioning.
packer build -var-file=prox.pkrvars.hcl proxmox.pkr.hcl
- After the build process is complete, you will have a new VM template in your Proxmox environment.
- Installing necessary packages
- Setting up Docker
- Creating a new user with sudo privileges
- Configuring Fish shell with Starship prompt
- Setting up SSH for the new user
- Cleaning up the system
The cleanup.sh
script is used to clean up the system before the image is converted to a template. It removes unnecessary files and packages, clears logs, and more.
The fish_greeting.fish
file is used to display the message of the day (MOTD) when opening a new Fish shell.
The config.fish.j2
file is a Jinja2 template for the Fish shell configuration file. It sets up various aliases and other configurations.
The motd.txt
file is custom ASCII art that will show on every SSH login. Please customise it before deploying or remove it as desired.
____
| _ \ _ __ _____ ___ __ ___ _____ __
| |_) | '__/ _ \ \/ / '_ ` _ \ / _ \ \/ /
| __/| | | (_) > <| | | | | | (_) > <
|_| |_| \___/_/\_\_| |_| |_|\___/_/\_\
| |__ _ _
| '_ \| | | |
| |_) | |_| |
|_.__/ \__, |
_ __ |___/ _ __ __
| |/ /_ __ _ _ _ __ | |_(_) ___ _ __ \ \/ /
| ' /| '__| | | | '_ \| __| |/ _ \| '_ \ \ /
| . \| | | |_| | |_) | |_| | (_) | | | |/ \
|_|\_\_| \__, | .__/ \__|_|\___/|_| |_/_/\_\
|___/|_|