packer-hcloud/README.md

45 lines
2.0 KiB
Markdown
Raw Permalink Normal View History

2022-09-08 15:01:32 +02:00
# packer-hcloud
2024-01-14 21:25:46 +01:00
[![Build Status](https://ci.rknet.org/api/badges/infra/packer-hcloud/status.svg)](https://ci.rknet.org/repos/infra/packer-hcloud)
2022-09-08 15:01:32 +02:00
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?label=license)](LICENSE)
2024-01-14 21:25:46 +01:00
This repository provides infrastructure-as-code examples to automate the creation of virtual machine images on Hetzner Cloud using [HashiCorp Packer](https://www.packer.io) and the [Packer Plugin for Hetzner Cloud](https://developer.hashicorp.com/packer/integrations/hetznercloud/hcloud). All examples are written in the HashiCorp Configuration Language `HCL2`.
2022-09-08 15:01:32 +02:00
This project is inspired by [jktr/hcloud-packer-templates](https://github.com/jktr/hcloud-packer-templates).
## Requirements
**Packer**:
2024-01-14 21:25:46 +01:00
- HashiCorp [Packer](https://developer.hashicorp.com/packer/tutorials/docker-get-started/get-started-install-cli)
- HashiCorp [Packer Plugin for Hetzner Cloud](https://developer.hashicorp.com/packer/integrations/hetznercloud/hcloud) (`hcloud`)
2022-09-08 15:01:32 +02:00
Required plugins are automatically downloaded during the `packer init` phase. These plugins are placed in the same directory as your Packer executable `/usr/local/bin` or `$HOME/.packer.d/plugins`.
## Configuration
### Download the release
Download the **latest** release.
### Configure the Variables
2024-01-14 21:25:46 +01:00
All available [variables](https://developer.hashicorp.com/packer/docs/templates/hcl_templates/variables) are defined in the `variables.pkr.hcl` files. They can be overwritten using environment variables or in the `server.auto.pkrvars.hcl` file.
2022-09-08 15:01:32 +02:00
### Modify the Configurations and Scripts (Optional)
If required, modify the configuration and scripts files.
## Build
> **Info:** Using the force flag will automatically remove existing _templates_ with a matching name or VMID.
2022-09-08 15:01:32 +02:00
```Shell
packer init rocky-9/
packer build -force rocky-9/
2022-09-08 15:01:32 +02:00
```
## License
2024-01-14 21:25:46 +01:00
This project is licensed under the MIT License - see the [LICENSE](https://gitea.rknet.org/infra/packer-hcloud/src/branch/main/LICENSE) file for details.