59 lines
1.4 KiB
Markdown
59 lines
1.4 KiB
Markdown
# Pi-hole instalation
|
|
|
|
These files allow you to install Pi-hole in an idempotent way. Terraform creates
|
|
the VM on Proxmox, and Ansible installs Pi-hole unattended, using the configuration
|
|
defined in `pihole.toml`.
|
|
|
|
## Terraform execution
|
|
|
|
To create the VM with Terraform, the configuration must be defined in the `terraform.tfvars`
|
|
file. You can use `terraform.tfvars.example` as a base.
|
|
|
|
Then to execute the following commands:
|
|
|
|
1. Intialize terraform
|
|
```bash
|
|
terraform init
|
|
```
|
|
|
|
2. Review the plan
|
|
```bash
|
|
terraform plan
|
|
```
|
|
|
|
3. Apply the plan.
|
|
|
|
This step might take a few minutes but if it takes significantly longer,
|
|
there may be an issue with cloud-init.
|
|
```bash
|
|
terraform apply
|
|
```
|
|
|
|
After execution, the `ansible` folder should contain a new `inventory.yaml` file.
|
|
|
|
## Ansible execution
|
|
|
|
To install Pi-hole with Ansible, make sure the `inventory.yaml` file exists,
|
|
and adjust `pihole.toml` if needed.
|
|
|
|
Then run:
|
|
|
|
```bash
|
|
ansible-playbook install.yaml
|
|
```
|
|
|
|
|
|
## Reinstallation
|
|
|
|
If you need to reinstall everything in the same environment,
|
|
destroy and recreate the Terraform resources using:
|
|
|
|
```bash
|
|
terraform destroy
|
|
```
|
|
|
|
## Reference
|
|
[Unattended Pi-hole v6 Setup with Ansible](https://www.paulcourt.co.uk/articles/2025/unattended-pihole-ansible)
|
|
|
|
[Configure a VM with Cloud-Init](https://registry.terraform.io/providers/bpg/proxmox/latest/docs/guides/cloud-init)
|