aboutsummaryrefslogtreecommitdiff
path: root/packer/scripts/install-prerequisites.sh
diff options
context:
space:
mode:
authorheqnx <root@heqnx.com>2025-06-26 11:21:21 +0300
committerheqnx <root@heqnx.com>2025-06-26 11:21:21 +0300
commit895042a3161b29832b398067a64d6187c8830cc4 (patch)
tree1b6f1dbebdc5eca190ec9bbf6fbc5251ad4aead9 /packer/scripts/install-prerequisites.sh
parentb8041662a4e6cd52cbb95e8f7f84c4246f5d24ca (diff)
downloadansible-pve-host-895042a3161b29832b398067a64d6187c8830cc4.tar.gz
ansible-pve-host-895042a3161b29832b398067a64d6187c8830cc4.zip
ignoring packer .lock files
Diffstat (limited to 'packer/scripts/install-prerequisites.sh')
-rw-r--r--packer/scripts/install-prerequisites.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/packer/scripts/install-prerequisites.sh b/packer/scripts/install-prerequisites.sh
new file mode 100644
index 0000000..43880b9
--- /dev/null
+++ b/packer/scripts/install-prerequisites.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+test "${EUID}" -ne 0 && printf "%s\n" "run as root" && exit 1
+
+if ! command -v apt-get &>/dev/null; then
+ printf "%s\n" "[err] distribution not debian-based"
+ exit 1
+fi
+
+export DEBIAN_FRONTEND=noninteractive
+export NEEDRESTART_SUSPEND=1
+apt-get update
+apt-get install -y \
+ curl ca-certificates gpg lsb-release \
+ lsb-release xorriso qemu-system-x86
+
+curl -sSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
+printf "%s" "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list
+apt-get update
+apt-get install -y packer
+
+hash -r
+
+plugins=$(packer plugins installed)
+
+if ! printf "%s\n" "${plugins}" | grep -qi qemu; then
+ packer plugins install github.com/hashicorp/qemu
+ printf "%s\n" "[inf] installed packer qemu plugin"
+else
+ printf "%s\n" "[inf] packer qemu plugin already installed"
+fi
+
+curl -fsSL https://get.docker.com | bash