packer-builds

Packer Builds for LXC and Libvirt
git clone https://git.in0rdr.ch/packer-builds.git
Log | Files | Refs | Pull requests |Archive | README

borg-backup-lxc.pkr.hcl (998B)


      1 variable "manifest" {
      2   type    = string
      3   default = "manifest.json"
      4 }
      5 
      6 variable "borg_repo" {
      7   type    = string
      8   default = "rclone:pcloud:borg-backup"
      9 }
     10 
     11 variable "borg_passphrase" {
     12   type      = string
     13   sensitive = true
     14 }
     15 
     16 variable "patternsfile" {
     17   type    = string
     18   default = "/root/.config/borg/patterns.lst"
     19 }
     20 
     21 source "lxc" "borg-backup-build" {
     22   config_file         = "config/lxc-config"
     23   template_name       = "download"
     24   template_parameters = ["--dist", "Debian", "--release", "Bookworm", "--arch", "armv7l"]
     25 }
     26 
     27 build {
     28   sources = ["source.lxc.borg-backup-build"]
     29 
     30   provisioner "shell" {
     31     script = "scripts/timezone.sh"
     32   }
     33 
     34   provisioner "shell" {
     35     environment_vars = [
     36       "BORG_REPO=${var.borg_repo}",
     37       "BORG_PASSPHRASE=${var.borg_passphrase}",
     38       "PATTERNSFILE=${var.patternsfile}",
     39     ]
     40     script = "scripts/borg-backup.sh"
     41   }
     42 }
     43 
     44 packer {
     45   required_plugins {
     46     lxc = {
     47       version = ">= 1.0.2"
     48       source  = "github.com/hashicorp/lxc"
     49     }
     50   }
     51 }