[readme] feat: added script documentation

This commit is contained in:
Simon Cornet 2024-07-15 15:06:01 +02:00
parent e56e9ccd88
commit b0c2ac1d64

View File

@ -1,25 +1,24 @@
# What does this stuff do? # 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. 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 # Template
Inside the template packer does: Inside the template packer does:
- Install updates - Install updates
- Install tools; curl, qemu-guest agent, sudo and wget. - Install tools; curl, qemu-guest agent, sudo and wget.
- Install Ansible user with private key - Install Ansible user with private key
- Clean guest (machine-id, logs, apt cache, etc) - Clean guest (machine-id, logs, package cache, etc)
Other information to know: Other information to know:
- Template hostname: `localhost` - Template hostname: `localhost`
- packer username: `packer` - packer username: `packer`
- packer password: `packer` - packer password: `packer`
- Ubuntu 24 Template: VM ID 999
More info: https://developer.hashicorp.com/packer/docs/intro More info: https://developer.hashicorp.com/packer/docs/intro
| OS | VM Name | VM ID | | OS | VM Name | VM ID | Script |
|----|---------|-------| |----|---------|-------|--------|
| Ubuntu 24 | ubuntu.template.siempie.internal | 999 | | Ubuntu 24 | ubuntu.template.siempie.internal | 999 | scripts/ubuntu24.sh |
# Install packer # Install packer
Install packer on your system: Install packer on your system:
@ -29,12 +28,17 @@ https://developer.hashicorp.com/packer/tutorials/docker-get-started/get-started-
Copy the `variables.pkrvars.hcl.example` file to `variables.pkrvars.hcl` and change the variables. Copy the `variables.pkrvars.hcl.example` file to `variables.pkrvars.hcl` and change the variables.
# Initialize the project and install the proxmox provider # Initialize the project and install the proxmox provider
This will initialize packer and install the required proxmox plugin.
``` ```
packer init -var-file variables.pkrvars.hcl ubuntu24/packer.pkr.hcl packer init -var-file variables.pkrvars.hcl ubuntu24/packer.pkr.hcl
``` ```
# Customization
Since packer allows either an inline or a script execution there is a script per template.
See the table above for the specific location per template.
# Usage # Usage
Ubuntu 24 Ubuntu 24 Template:
``` ```
packer build -force -var-file variables.pkrvars.hcl ubuntu24/packer.pkr.hcl packer build -force -var-file variables.pkrvars.hcl ubuntu24/packer.pkr.hcl
``` ```