packer/readme.md
2024-07-15 12:58:32 +00:00

42 lines
1.3 KiB
Markdown

# What does this stuff do?
Packer is a tool that can create Virtual Machine templates from code. This repository hosts the code for a customized templates used in Siempie's home environment using the Proxmox Hypervisor.
# Template
Inside the template packer does:
- Install updates
- Install tools; curl, qemu-guest agent, sudo and wget.
- Install Ansible user with private key
- Clean guest (machine-id, logs, apt cache, etc)
Other information to know:
- Template hostname: `localhost`
- packer username: `packer`
- packer password: `packer`
- Ubuntu 24 Template: VM ID 999
More info: https://developer.hashicorp.com/packer/docs/intro
| OS | VM Name | VM ID |
|----|---------|-------|
| Ubuntu 24 | ubuntu.template.siempie.internal | 999 |
# Install packer
Install packer on your system:
https://developer.hashicorp.com/packer/tutorials/docker-get-started/get-started-install-cli
# Variables
Copy the `variables.pkrvars.hcl.example` file to `variables.pkrvars.hcl` and change the variables.
# Initialize the project and install the proxmox provider
```
packer init -var-file variables.pkrvars.hcl ubuntu24/packer.pkr.hcl
```
# Usage
Ubuntu 24
```
packer build -force -var-file variables.pkrvars.hcl ubuntu24/packer.pkr.hcl
```
Note: the `-force` flag removes an already existing VM or Template with the same ID (999).