summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Berto <463349+robertoberto@users.noreply.github.com>2024-05-13 19:53:14 +0000
committerRoberto Berto <463349+robertoberto@users.noreply.github.com>2024-05-13 19:53:14 +0000
commit8e90d13f6d762bbd0167ddfe26dddd2884ab3dfe (patch)
tree50e428b1ec0fbbfa4ec3b5390b97a5fcc2b5ca02
parent666055f758690ee24926e4a421e08f7c97deee09 (diff)
downloadpacker-vyos-8e90d13f6d762bbd0167ddfe26dddd2884ab3dfe.tar.gz
packer-vyos-8e90d13f6d762bbd0167ddfe26dddd2884ab3dfe.zip
image build ready level1 install-image
-rw-r--r--.gitignore5
-rw-r--r--Makefile62
-rw-r--r--README.md112
-rw-r--r--example.env33
-rw-r--r--http/debian_11-vyos.list6
-rw-r--r--http/debian_11.list5
-rw-r--r--http/debian_12-vyos.list6
-rw-r--r--http/debian_12.list5
-rw-r--r--http/install-image.py55
-rw-r--r--scripts/vyos/apt-install.sh16
-rw-r--r--scripts/vyos/apt-repo-debian.sh33
-rw-r--r--scripts/vyos/apt-repo-vyos.sh33
-rw-r--r--scripts/vyos/cloud-init-debian.sh23
-rw-r--r--scripts/vyos/cloud-init-vyos.sh23
-rw-r--r--scripts/vyos/init.sh11
-rw-r--r--scripts/vyos/platform-qemu.sh13
-rw-r--r--scripts/vyos/vyos-install-post.sh10
-rw-r--r--scripts/vyos/vyos-install-pre.sh56
-rw-r--r--scripts/vyos/vyos-install.sh19
-rwxr-xr-xvnc-connect.sh14
-rw-r--r--vnc.sh11
-rw-r--r--vyos-image.pkr.hcl247
-rw-r--r--vyos.pkr.hcl266
-rw-r--r--vyos.pkrvars.hcl19
-rw-r--r--vyos1.3.pkr.hcl205
25 files changed, 1062 insertions, 226 deletions
diff --git a/.gitignore b/.gitignore
index f8b2d1c..7cd3bea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
local.pkrvars.hcl
.env
output-*
-iso/* \ No newline at end of file
+iso/*
+*.code-workspace
+dev/
+*.checksum
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f40121d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,62 @@
+#!make
+
+# if not set, set defaults
+PARALLEL_BUILDS ?= 0
+PACKER_LOG ?= 0
+# always use DISPLAY :99
+DISPLAY=:99
+#export DISPLAY
+# include .env vars
+-include .env
+# export all
+export
+
+.PHONY: help build init upgrade clean x11
+
+help:
+ @echo "make working:"
+ @echo "- will use local.pkrvars.hcl if exists or vyos.pkrvars.hcl"
+ @echo "- will load .env if file exists"
+
+ @echo "make usage:"
+ @echo " make build - build image with 'packer build'"
+ @echo " make init - init 'packer init'"
+ @echo " make upgrade - init 'packer init -upgrade'"
+ @echo " make clean - remove output files"
+ @echo " make x11server - start Xvfb X11 server on DISPLAY=:99. Require apt install xvfb"
+
+
+# ifneq ("$(wildcard .env)","")
+# include .env
+# export
+# endif
+
+
+
+build:
+# if exist local.pkrvars.hcl load it
+ifneq ($(wildcard local.pkrvars.hcl),)
+ packer build \
+ -var-file=local.pkrvars.hcl \
+ -parallel-builds=$(PARALLEL_BUILDS) \
+ vyos.pkr.hcl
+else
+ packer build \
+ -var-file=vyos.pkrvars.hcl \
+ -parallel-builds=$(PARALLEL_BUILDS) \
+ vyos.pkr.hcl
+endif
+
+init:
+ packer init vyos.pkr.hcl
+
+upgrade:
+ packer init -upgrade vyos.pkr.hcl
+
+clean:
+ rm -rf output-*
+
+# you need to run this first to use headless=false
+x11server:
+ Xvfb :99 -screen 0 1024x768x16 &
+ export DISPLAY=:99
diff --git a/README.md b/README.md
index 5fb25dd..54758f4 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,106 @@
-root@ds1s1$
- Xvfb :99 -screen 0 1024x768x16
- export DISPLAY=:99
- packer build
-wsl2$
- ssh ubuntu@10.18.0.37 -i keys/privateos_rsa -X -v
+# Introdution
-ubuntu@ds1s1:~$
- export DISPLAY=:99
- vncviewer -shared 127.0.0.1:5990
+As VyOS is becoming more popular, building and automating images are essential. Packer is flexible and
+can create custom images easily for any cloud and bare metal needs.
+
+While VyOS has its own tools for creating images and building like [https://github.com/vyos/vyos-vm-images vyos-vm-images]
+or [https://github.com/vyos/vyos-build vyos-build], they lack features hashicorp packer can provide for automating images.
+vyos-vm-images use ansible for build images, you can do almost any lower level customatization using this great tool.
+vyos-build can be customizated and create custom images as well.
+
+Some notes about packer-vyos:
+* packer-vyos audience is for devops who understand how packer works
+* packer-vyos use qemu for default building
+* packer-vyos image can access internet inside building VM and download custom packages
+
+
+## How build process works:
+
+* you should provides an vyos.iso for builder
+** this iso can be a LTS/oficial one or nightly iso or you can use [https://docs.vyos.io/en/equuleus/contributing/build-vyos.html vyos-build] to build an iso
+* packer-vyos will install VyOS same way than manually installations
+** packer-vyos will start vyos.iso image in a qemu VM, VyOS will run in Live CD mode inside a qemu VM
+** packer will provide DHCP server, 1 ipv4, 1 gateway with NAT for qemu images
+** packer will provide a http server serving http/* folder files to VyOS, so we can use it to customize image
+** packer can provide for development with headless=false mode a vnc server, so we can see what is running on VM console
+** packer-vyos will send keyboard commands to VyOS Live CD like default vyos / vyos username/password
+** packer-vyos will configure networking to use dhcp ```set interface ethernet eth0 address dhcp```, than ```commit```
+** packer-vyos will customize images using scripts/vyos/*.sh according to rules inside vyos.pkr.hcl
+** after all scripts packer-vyos will install image to disk using VyOS ```install image```
+** packer will write image on output-* folder
+
+# Features
+
+* add debian 11/12 sources in apt-sources.d before install
+* remove debian 11/12 sources in apt-sources.d before install
+* install custom packages using apt install
+* install cloud-init from the upstream Debian repository or the custom version provided by VyOS
+* do any shell command or vyos command before to install
+* cleanup and prepare everything to turn vyos into cloud image
+* simple parameters as disk size or image name can be customized easily
+* install qemu-guest-agent
+* customize to install any other agent or package as needed
+* grub with kvm/serial
+* disable/enable ssh
+* disable/enable dhcp
+* set interface/gateway
+* keep vyos/vyos user/password or customize it
+* it is possible to build custom images for bare metal, docker or any virtualization or cloud providers
+* also it is possible to integrate building process using other [https://developer.hashicorp.com/packer/integrations?components=builder packer builders]
+besides qemu like aws, azure, cloudstack, docker, gcp, proxmox, vagrant, virtualbox, vmware and others
+
+# Requirements
+
+* packer-vyos is develop using ubuntu 24 LTS, but should run in debian, you can try other distros
+* packer-vyos use qemu, build inside a VM needs vmx/svm instruction. VMs inside proxmox need cpu=host
+** check if virtualization is enabled
+```
+egrep '(vmx|svm)' --color=always /proc/cpuinfo
+```
+** enabling neasted virtualization in proxmox:
+```
+qm set <vmid> --cpu host
+```
+* use root to build, for production use a dedicated vm only for packer build with cpu=host
+
+
+## Packages requirements:
+
+```
+apt install make
+apt install qemu-system
+```
+
+## headless=false
+
+For headless=false follow development instructions bellow.
+
+# Debugging / development
+
+* headless=true is recommended
+* to turn headless=true use vncviewer (apt install tigervnc-viewer)
+* for compilling packages remotely use Xvfb (apt install xvfb)
+* for forward X11 ports use ssh forwarding (ssh -X -v or ssh -Y -v if -X doesn't works)
+* edit vnc-connect.sh and ajuste VNC ports, it is possible to get ports dinamicly saving packer log to a file and parsing, but for now put VNC_PORT_FIXED=5900 on .env and it will work. As soon as VNC server open port vncviewer will run and it. If you connect to ssh using X11 port forwarding, it should open console on your local desktop. Windows WSL2 offer X11 Server native and it works.
+* in headless/remote ssh, before make build you need to start Xvfb. ```make x11server``` start X11 server, but you can put on init with something like https://gist.github.com/jterrace/2911875
+* for SSH access put in .env SLEEP_BEFORE_SHUTDOWN=600 to keep SSH on for 10 minutes after scripts run. Also put HOST_PORT_FIXED=2222 for open SSH in VM 127.0.0.1 in port 2222. ```ssh vyos@127.0.0.1 -p 2222``` default password is vyos.
+
+# Install
+
+# Usage
+* local.pkrvars.hcl if exists or will use default vars inside vyos.pkrvars.hcl if local not exists
+** local-example.pkrvars.hcl is provided in git repo as base of local.pkrvars.hcl
+* if .env exists will load
+** example.env is provided in git repo as base of .env
+
+# Initialize packer
+Packer need to load plugins first.
+
+Use:
+* ```make init```, for first time init
+* ```make upgrade```, when want to upgrade plugins
+
+# Build
+* ```make build```, for build images
diff --git a/example.env b/example.env
new file mode 100644
index 0000000..6a9747c
--- /dev/null
+++ b/example.env
@@ -0,0 +1,33 @@
+
+# this env vars are all for development purposes
+# use local.pkrvars.hcl for production
+
+# PACKER_LOG=1 will show more packer output (leave 0 for automated packer deployments reduce verbosity)
+PACKER_LOG=1
+
+# PARALLEL_BUILDS=0 unlimited build in parallel (leave 0 for automated packer deployments to turn on parallels builds)
+PARALLEL_BUILDS=1
+
+# Choose a fixed vnc port or unset to chose random port (leave unset for automated packer deployments)
+VNC_PORT_FIXED=5900
+
+# Choose a fixed host/ssh port or unset to chose random port (leave unset for automated packer deployments)
+HOST_PORT_FIXED=2222
+
+# Seconds before shutdown (put few 300 or 600 if need to access ssh for developing on packer-vyos)
+SLEEP_BEFORE_SHUTDOWN=0
+
+# Recommendation for development :
+# VNC_PORT_FIXED=5900
+# HOST_PORT_FIXED=2222
+# PACKER_LOG=1
+# PARALLEL_BUILDS=1
+# SLEEP_BEFORE_SHUTDOWN=300
+
+# Recommendation for production:
+# PARALLEL_BUILDS=1
+# PACKER_LOG=0
+# SLEEP_BEFORE_SHUTDOWN=0
+# and comment those to undefine vars:
+# #VNC_PORT_FIXED
+# #HOST_PORT_FIXED
diff --git a/http/debian_11-vyos.list b/http/debian_11-vyos.list
new file mode 100644
index 0000000..f91508d
--- /dev/null
+++ b/http/debian_11-vyos.list
@@ -0,0 +1,6 @@
+# temporary debian list to add debian software
+deb http://deb.debian.org/debian buster main contrib non-free
+deb-src http://deb.debian.org/debian buster main contrib non-free
+deb http://security.debian.org/debian-security/ buster/updates main contrib non-free
+deb-src http://security.debian.org/debian-security/ buster/updates main contrib non-free
+deb http://dev.packages.vyos.net/repositories/equuleus equuleus main
diff --git a/http/debian_11.list b/http/debian_11.list
new file mode 100644
index 0000000..a791d21
--- /dev/null
+++ b/http/debian_11.list
@@ -0,0 +1,5 @@
+# temporary debian list to add debian software
+deb http://deb.debian.org/debian buster main contrib non-free
+deb-src http://deb.debian.org/debian buster main contrib non-free
+deb http://security.debian.org/debian-security/ buster/updates main contrib non-free
+deb-src http://security.debian.org/debian-security/ buster/updates main contrib non-free
diff --git a/http/debian_12-vyos.list b/http/debian_12-vyos.list
new file mode 100644
index 0000000..46e7c28
--- /dev/null
+++ b/http/debian_12-vyos.list
@@ -0,0 +1,6 @@
+# temporary debian list to add debian software
+deb http://deb.debian.org/debian bookworm main contrib non-free
+deb-src http://deb.debian.org/debian bookworm main contrib non-free
+deb http://security.debian.org/debian-security/ bookworm/updates main contrib non-free
+deb-src http://security.debian.org/debian-security/ bookworm/updates main contrib non-free
+deb http://dev.packages.vyos.net/repositories/current current main
diff --git a/http/debian_12.list b/http/debian_12.list
new file mode 100644
index 0000000..8dc95b8
--- /dev/null
+++ b/http/debian_12.list
@@ -0,0 +1,5 @@
+# temporary debian list to add debian software
+deb http://deb.debian.org/debian bookworm main contrib non-free
+deb-src http://deb.debian.org/debian bookworm main contrib non-free
+deb http://security.debian.org/debian-security/ bookworm/updates main contrib non-free
+deb-src http://security.debian.org/debian-security/ bookworm/updates main contrib non-free
diff --git a/http/install-image.py b/http/install-image.py
new file mode 100644
index 0000000..6a7f314
--- /dev/null
+++ b/http/install-image.py
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+
+import pexpect
+import time
+import sys
+import os
+
+var_vm_name = os.getenv("VM_NAME", "vyos")
+var_ssh_password = os.getenv("VM_PASSWORD", "vyos")
+
+install_process = pexpect.spawn("/opt/vyatta/sbin/install-image", logfile=sys.stdout, encoding='utf-8')
+
+install_process.expect("Would you like to continue")
+time.sleep(0.2)
+install_process.sendline("Yes")
+
+install_process.expect("Partition")
+time.sleep(0.2)
+install_process.sendline("Auto")
+
+install_process.expect("Install the image on")
+time.sleep(0.2)
+install_process.sendline("")
+
+install_process.expect("Continue")
+time.sleep(0.2)
+install_process.sendline("Yes")
+
+install_process.expect("How big of a root partition should I create")
+time.sleep(0.2)
+install_process.sendline("")
+
+install_process.expect("What would you like to name this image")
+time.sleep(0.2)
+install_process.sendline(var_vm_name)
+
+install_process.expect("Which one should I copy to")
+time.sleep(0.2)
+install_process.sendline("")
+
+install_process.expect("Enter password for user")
+time.sleep(0.2)
+install_process.sendline(var_ssh_password)
+
+install_process.expect("Retype password for user")
+time.sleep(0.2)
+install_process.sendline(var_ssh_password)
+
+install_process.expect("Which drive should GRUB modify the boot partition on")
+time.sleep(0.2)
+install_process.sendline("")
+
+# wait until process ends
+install_process.wait()
+
diff --git a/scripts/vyos/apt-install.sh b/scripts/vyos/apt-install.sh
new file mode 100644
index 0000000..0e47bce
--- /dev/null
+++ b/scripts/vyos/apt-install.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+set -x
+
+export DEBIAN_FRONTEND=noninteractive
+
+# install missing vyos features, you can comment it if not needed
+apt install -y \
+ vim \
+ net-tools
+
+# install packer-vyos requirements (it will be removed at cleanup.sh)
+apt install -y \
+ python3-pexpect \
+ expect
diff --git a/scripts/vyos/apt-repo-debian.sh b/scripts/vyos/apt-repo-debian.sh
new file mode 100644
index 0000000..be360fb
--- /dev/null
+++ b/scripts/vyos/apt-repo-debian.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "${CLOUD_INIT}" != "debian" ]]; then
+ echo "$0 - info: cloud_init not debian, skipping"
+ exit 0
+fi
+
+# set debian list according VYOS_VERSION_MAIN
+if [[ "$VYOS_RELEASE" == "equuleus" ]]; then
+ debian_list_url="http://${PACKER_HTTP_IP}:${PACKER_HTTP_PORT}/debian_11.list"
+elif [[ "$VYOS_RELEASE" == "current" || "$VYOS_RELEASE" == "sagitta" || "$VYOS_RELEASE" == "circinus" ]]; then
+ debian_list_url="http://${PACKER_HTTP_IP}:${PACKER_HTTP_PORT}/debian_12.list"
+else
+ echo "vyos version unsupported, get github repo, fork and send a pull request"
+ exit 1
+fi
+
+tmp_file=$(mktemp)
+
+wget -O "$tmp_file" "$debian_list_url" || { echo "cant download debian.list from packer http repo"; exit 1; }
+
+mv "$tmp_file" /etc/apt/sources.list.d/debian.list
+
+apt update
+
+
+#sudo bash -c 'echo "deb http://deb.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list.d/debian.list'
+#sudo bash -c 'echo "deb-src http://deb.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list.d/debian.list'
+#sudo bash -c 'echo "deb http://security.debian.org/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list.d/debian.list'
+#sudo bash -c 'echo "deb-src http://security.debian.org/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list.d/debian.list'
diff --git a/scripts/vyos/apt-repo-vyos.sh b/scripts/vyos/apt-repo-vyos.sh
new file mode 100644
index 0000000..db7d58a
--- /dev/null
+++ b/scripts/vyos/apt-repo-vyos.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "${CLOUD_INIT}" != "vyos" ]]; then
+ echo "$0 - info: cloud_init not vyos, skipping"
+ exit 0
+fi
+
+# set debian list according VYOS_VERSION_MAIN
+if [[ "$VYOS_RELEASE" == "equuleus" ]]; then
+ debian_list_url="http://${PACKER_HTTP_IP}:${PACKER_HTTP_PORT}/debian_11-vyos.list"
+elif [[ "$VYOS_RELEASE" == "current" || "$VYOS_RELEASE" == "sagitta" || "$VYOS_RELEASE" == "circinus" ]]; then
+ debian_list_url="http://${PACKER_HTTP_IP}:${PACKER_HTTP_PORT}/debian_12-vyos.list"
+else
+ echo "vyos version unsupported, get github repo, fork and send a pull request"
+ exit 1
+fi
+
+tmp_file=$(mktemp)
+
+wget -O "$tmp_file" "$debian_list_url" || { echo "cant download debian.list from packer http repo"; exit 1; }
+
+mv "$tmp_file" /etc/apt/sources.list.d/debian.list
+
+apt update
+
+
+#sudo bash -c 'echo "deb http://deb.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list.d/debian.list'
+#sudo bash -c 'echo "deb-src http://deb.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list.d/debian.list'
+#sudo bash -c 'echo "deb http://security.debian.org/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list.d/debian.list'
+#sudo bash -c 'echo "deb-src http://security.debian.org/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list.d/debian.list'
diff --git a/scripts/vyos/cloud-init-debian.sh b/scripts/vyos/cloud-init-debian.sh
new file mode 100644
index 0000000..2cf398f
--- /dev/null
+++ b/scripts/vyos/cloud-init-debian.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "${CLOUD_INIT}" != "debian" ]]; then
+ echo "$0 - info: cloud_init not debian, skipping"
+ exit 0
+fi
+
+export DEBIAN_FRONTEND=noninteractive
+
+apt purge -y \
+ cloud-init \
+ cloud-utils \
+ ifupdown
+
+apt install -y \
+ cloud-init \
+ cloud-utils \
+ ifupdown
+
+systemctl enable cloud-init
diff --git a/scripts/vyos/cloud-init-vyos.sh b/scripts/vyos/cloud-init-vyos.sh
new file mode 100644
index 0000000..92be545
--- /dev/null
+++ b/scripts/vyos/cloud-init-vyos.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "${CLOUD_INIT}" != "vyos" ]]; then
+ echo "$0 - info: cloud_init not vyos, skipping"
+ exit 0
+fi
+
+export DEBIAN_FRONTEND=noninteractive
+
+apt purge -y \
+ cloud-init \
+ cloud-utils \
+ ifupdown
+
+apt install -t "$VYOS_RELEASE" --force-yes -y \
+ cloud-init \
+ cloud-utils \
+ ifupdown
+
+systemctl enable cloud-init
diff --git a/scripts/vyos/init.sh b/scripts/vyos/init.sh
new file mode 100644
index 0000000..7f0db84
--- /dev/null
+++ b/scripts/vyos/init.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+set -x
+
+# configure machine-id
+dbus-uuidgen > /etc/machine-id
+ln -fs /etc/machine-id /var/lib/dbus/machine-id
+
+# disable logs
+systemctl stop rsyslog
diff --git a/scripts/vyos/platform-qemu.sh b/scripts/vyos/platform-qemu.sh
new file mode 100644
index 0000000..d4049fa
--- /dev/null
+++ b/scripts/vyos/platform-qemu.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "${PLATFORM}" != "qemu" ]]; then
+ echo "$0 - info: platform not qemu, skipping"
+ exit 0
+fi
+
+export DEBIAN_FRONTEND=noninteractive
+apt install -y \
+ qemu-guest-agent
diff --git a/scripts/vyos/vyos-install-post.sh b/scripts/vyos/vyos-install-post.sh
new file mode 100644
index 0000000..15b723e
--- /dev/null
+++ b/scripts/vyos/vyos-install-post.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+set -e
+set -x
+
+# removing temp scripts
+#rm -f /root/answers.expect
+rm -f /root/install-image.py
+
+#sleep 1000 \ No newline at end of file
diff --git a/scripts/vyos/vyos-install-pre.sh b/scripts/vyos/vyos-install-pre.sh
new file mode 100644
index 0000000..c61905d
--- /dev/null
+++ b/scripts/vyos/vyos-install-pre.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+set -e
+set -x
+
+export DEBIAN_FRONTEND=noninteractive
+
+# delete interfaces ethernet eth0 address
+# delete interfaces ethernet eth0 hw-id
+# delete system name-server
+
+cat <<EOF > /home/vyos/cleanup-vyos.sh
+#!/bin/vbash
+source /opt/vyatta/etc/functions/script-template
+configure
+set system host-name host-name 'test'
+commit
+save
+exit
+EOF
+chmod 0700 /home/vyos/cleanup-vyos.sh
+chown vyos:users /home/vyos/cleanup-vyos.sh
+su - vyos -c "/home/vyos/cleanup-vyos.sh"
+
+# reconfiguring ssh
+rm -f /etc/ssh/ssh_host_*
+dpkg-reconfigure openssh-server
+
+# those packages can't be removed since they are needed for next script vyos-install.sh
+# apt remove -y \
+# python3-pexpect \
+# expect
+
+# cleanup apt
+rm -f /etc/apt/sources.list.d/debian.list
+apt -y autoremove --purge
+apt-get clean
+
+# cleanup machine-id
+truncate -s 0 /etc/machine-id
+
+# removing /tmp files
+rm -rf /tmp/*
+
+# removing log files
+rm -rf /var/log/*
+
+# removing history
+export HISTFILE=0
+rm -f /home/vyos/.bash_history
+rm -f /root/.bash_history
+
+# removing disk data
+dd if=/dev/zero of=/EMPTY bs=1M || :
+rm -f /EMPTY
+sync
diff --git a/scripts/vyos/vyos-install.sh b/scripts/vyos/vyos-install.sh
new file mode 100644
index 0000000..aa23064
--- /dev/null
+++ b/scripts/vyos/vyos-install.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -e
+set -x
+
+# answers_url=http://${PACKER_HTTP_IP}:${PACKER_HTTP_PORT}/answers.expect
+# install_url=http://${PACKER_HTTP_IP}:${PACKER_HTTP_PORT}/install-image.vsh
+install_url=http://${PACKER_HTTP_IP}:${PACKER_HTTP_PORT}/install-image.py
+
+# touch /root/answers.expect
+# chmod 0600 /root/answers.expect
+# wget $answers_url -O /root/answers.expect
+
+touch /root/install-image.py
+chmod 0700 /root/install-image.py
+wget $install_url -O /root/install-image.py
+
+python3 /root/install-image.py
+
diff --git a/vnc-connect.sh b/vnc-connect.sh
new file mode 100755
index 0000000..abb4f2c
--- /dev/null
+++ b/vnc-connect.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+#export DISPLAY=:99
+
+VNC_HOST=127.0.0.1
+VNC_PORT=5900
+
+while ! nc -z $VNC_HOST $VNC_PORT; do
+ sleep 1
+ echo "waiting for vnc in $VNC_HOST:$VNC_PORT ..."
+done
+echo "vnc on."
+
+vncviewer -shared $VNC_HOST:$VNC_PORT
diff --git a/vnc.sh b/vnc.sh
deleted file mode 100644
index 0967ac6..0000000
--- a/vnc.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#export DISPLAY=:99
-
-while ! nc -z 127.0.0.1 5904; do
- sleep 1
- echo "waiting for vnc..."
-done
-echo "vnc on."
-
-vncviewer -shared 127.0.0.1:5904
diff --git a/vyos-image.pkr.hcl b/vyos-image.pkr.hcl
new file mode 100644
index 0000000..651f1d4
--- /dev/null
+++ b/vyos-image.pkr.hcl
@@ -0,0 +1,247 @@
+
+
+
+# dont edit those vars below, customize in local.auto.pkrvars.hcl using local.example.pkrvars.hcl
+variable "vm_name" {
+ default = "vyos-image-1.3.6"
+}
+
+variable "numvcpus" {
+ default = "4"
+}
+
+variable "memsize" {
+ default = "2048"
+}
+
+variable "disk_size" {
+ default = "10240"
+}
+
+variable "iso_checksum" {
+ default = "file:iso/SHA256SUM"
+}
+
+variable "ssh_username" {
+ default = "vyos"
+}
+
+variable "ssh_password" {
+ default = "vyos"
+}
+
+variable "boot_wait" {
+ default = "5s"
+}
+
+# - qemu: will build qcow2 image
+# - none: not supported
+variable "platform" {
+ type = string
+ default = "qemu"
+}
+
+# cloud-init values:
+# debian - will install/replace cloud-init packages
+# vyos - will keep cloud-init packages from vyos
+variable "cloud_init" {
+ type = string
+ default = "vyos"
+}
+
+# if true configure grub to use serial console as default
+variable "grub_serial" {
+ type = bool
+ default = true
+}
+
+# equuleus: debian 11 (branch 1.3.*)
+# sagitta: debian 12 (branch 1.4.*)
+# circinus: debian 12 (branch 1.5.*)
+# current: debian 12 (branch 1.5.*)
+variable "vyos_release" {
+ default = "equuleus"
+}
+
+# build will fail if headless is false, only use headless false if you prepared X11/vnc setup
+variable "headless" {
+ default = true
+}
+
+variable "host_port_min" {
+ default = env("HOST_PORT_FIXED") != "" ? env("HOST_PORT_FIXED") : 2222
+}
+variable "host_port_max" {
+ default = env("HOST_PORT_FIXED") != "" ? env("HOST_PORT_FIXED") : 4444
+}
+
+variable "vnc_port_min" {
+ default = env("VNC_PORT_FIXED") != "" ? env("VNC_PORT_FIXED") : 5900
+}
+variable "vnc_port_max" {
+ default = env("VNC_PORT_FIXED") != "" ? env("VNC_PORT_FIXED") : 6000
+}
+
+variable "sleep_before_shutdown" {
+ default = env("SLEEP_BEFORE_SHUTDOWN") != "" ? env("SLEEP_BEFORE_SHUTDOWN") : 0
+}
+
+# this is actually boot time between grub and user login. Need to be increased if your system in heavy load. A wait time too long will increase build time.
+variable "sleep_after_grub" {
+ default = "45" # in seconds
+}
+
+locals {
+ iso_path = "iso/${var.vm_name}.iso"
+ output_dir = "output-vyos-${regex_replace(timestamp(), "[: ]", "-")}"
+}
+
+source "qemu" "vyos" {
+ boot_command = [
+ "<enter>",
+ "<wait${var.sleep_after_grub}s>",
+ "${var.ssh_username}<enter><wait>",
+ "${var.ssh_password}<enter><wait>",
+ "configure<enter><wait>",
+ "set interfaces ethernet eth0 address 'dhcp'<enter><wait>",
+ "set system name-server '8.8.8.8'<enter><wait>",
+ "set service ssh port '22'<enter><wait>",
+ "commit<enter><wait>",
+ "save<enter><wait>",
+ "exit<enter><wait>",
+ ]
+
+ accelerator = "kvm"
+
+ iso_checksum = var.iso_checksum
+ #iso_url = fileexists(local.iso_path) ? local.iso_path : var.iso_url
+ iso_url = local.iso_path
+
+ boot_wait = var.boot_wait
+
+ http_directory = "http"
+
+ shutdown_command = "sleep ${var.sleep_before_shutdown}; sudo shutdown -P now"
+
+ communicator = "ssh"
+
+ host_port_min = var.host_port_min
+ host_port_max = var.host_port_max
+
+ ssh_username = var.ssh_username
+ ssh_password = var.ssh_password
+
+ ssh_timeout = "30m"
+
+ memory = var.memsize
+ cpus = var.numvcpus
+ disk_size = var.disk_size
+
+ vnc_port_min = var.vnc_port_min
+ vnc_port_max = var.vnc_port_max
+
+ headless = var.headless
+
+ output_directory = "${local.output_dir}"
+
+ net_device = "virtio-net"
+ disk_interface = "virtio"
+
+ qemuargs = [
+ ["-m", "2048"],
+ ["-smp", "4"],
+ ["-cpu", "host"],
+ ["-netdev", "user,id=user.0,", "hostfwd=tcp::{{ .SSHHostPort }}-:22"],
+ ["-device", "virtio-net,netdev=user.0"]
+ ]
+}
+
+build {
+ name = "vyos"
+
+ source "source.qemu.vyos" {
+ name = "vyos_qemu_qcow2"
+ vm_name = "${var.vm_name}-${source.name}.qcow2"
+ format = "qcow2"
+ }
+
+ # source "source.raw.vyos" {
+ # name = "vyos_qemu_raw"
+ # vm_name = "${var.vm_name}-${source.name}.raw"
+ # format = "raw"
+ # }
+
+
+ provisioner "shell-local" {
+ inline = [
+ "mkdir -p ${local.output_dir}"
+ ]
+ }
+
+ # preparing provisioner
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/init.sh",
+ ]
+ }
+
+ # installing apt repos and custom packages
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' CLOUD_INIT='${var.cloud_init}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/apt-repo-debian.sh",
+ "scripts/vyos/apt-repo-vyos.sh",
+ "scripts/vyos/apt-install.sh",
+ ]
+ }
+
+ # preparing cloud-init
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' CLOUD_INIT='${var.cloud_init}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/cloud-init-debian.sh",
+ "scripts/vyos/cloud-init-vyos.sh",
+ ]
+ }
+
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' PLATFORM='${var.platform}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/platform-qemu.sh"
+ ]
+ }
+
+ # cleanup before install
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/vyos-install-pre.sh",
+ ]
+ }
+
+ # install vyos on disk
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' VM_NAME='${var.vm_name}' VM_PASSWORD='${var.ssh_password}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/vyos-install.sh",
+ ]
+ }
+
+ # cleanup after install
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/vyos-install-post.sh",
+ ]
+ }
+
+ post-processors {
+ post-processor "shell-local" {
+ inline = [
+ "cp '${local.output_dir}/${var.vm_name}-${source.name}.qcow2' /mnt/pve/svm_privateos_ic1a_main/template/iso/"
+ ]
+ #only = ["vyos_qemu_qcow2"]
+ }
+ }
+} \ No newline at end of file
diff --git a/vyos.pkr.hcl b/vyos.pkr.hcl
new file mode 100644
index 0000000..2f7f2dd
--- /dev/null
+++ b/vyos.pkr.hcl
@@ -0,0 +1,266 @@
+
+# dont edit those vars below, customize in local.auto.pkrvars.hcl using local.example.pkrvars.hcl
+variable "vm_name" {
+ default = "vyos-1.3.6"
+}
+
+variable "numvcpus" {
+ default = "4"
+}
+
+variable "memsize" {
+ default = "2048"
+}
+
+variable "disk_size" {
+ default = "10240"
+}
+
+variable "iso_checksum" {
+ default = "file:iso/SHA256SUM"
+}
+
+variable "ssh_username" {
+ default = "vyos"
+}
+
+variable "ssh_password" {
+ default = "vyos"
+}
+
+variable "boot_wait" {
+ default = "5s"
+}
+
+# - qemu: will build qcow2 image
+# - none: not supported
+variable "platform" {
+ type = string
+ default = "qemu"
+}
+
+# cloud-init values:
+# debian - will install/replace cloud-init packages
+# vyos - will keep cloud-init packages from vyos
+variable "cloud_init" {
+ type = string
+ default = "vyos"
+}
+
+# if true configure grub to use serial console as default
+variable "grub_serial" {
+ type = bool
+ default = true
+}
+
+# equuleus: debian 11 (branch 1.3.*)
+# sagitta: debian 12 (branch 1.4.*)
+# circinus: debian 12 (branch 1.5.*)
+# current: debian 12 (branch 1.5.*)
+variable "vyos_release" {
+ default = "equuleus"
+}
+
+# build will fail if headless is false, only use headless false if you prepared X11/vnc setup
+variable "headless" {
+ default = true
+}
+
+variable "host_port_min" {
+ default = env("HOST_PORT_FIXED") != "" ? env("HOST_PORT_FIXED") : 2222
+}
+variable "host_port_max" {
+ default = env("HOST_PORT_FIXED") != "" ? env("HOST_PORT_FIXED") : 4444
+}
+
+variable "vnc_port_min" {
+ default = env("VNC_PORT_FIXED") != "" ? env("VNC_PORT_FIXED") : 5900
+}
+variable "vnc_port_max" {
+ default = env("VNC_PORT_FIXED") != "" ? env("VNC_PORT_FIXED") : 6000
+}
+
+variable "sleep_before_shutdown" {
+ default = env("SLEEP_BEFORE_SHUTDOWN") != "" ? env("SLEEP_BEFORE_SHUTDOWN") : 0
+}
+
+# this is actually boot time between grub and user login. Need to be increased if your system in heavy load. A wait time too long will increase build time.
+variable "sleep_after_grub" {
+ default = "45" # in seconds
+}
+
+locals {
+ iso_path = "iso/${var.vm_name}.iso"
+ output_dir = "output-vyos-${regex_replace(timestamp(), "[: ]", "-")}"
+}
+
+source "qemu" "vyos" {
+ boot_command = [
+ "<enter>",
+ "<wait${var.sleep_after_grub}s>",
+ "${var.ssh_username}<enter><wait>",
+ "${var.ssh_password}<enter><wait>",
+ "configure<enter><wait>",
+ "set interfaces ethernet eth0 address 'dhcp'<enter><wait>",
+ "set system name-server '8.8.8.8'<enter><wait>",
+ "set service ssh port '22'<enter><wait>",
+ "commit<enter><wait>",
+ "save<enter><wait>",
+ # "exit<enter><wait>",
+ "exit<enter><wait>",
+ "install image<enter><wait3s>",
+ "Yes<enter><wait>",
+ "Auto<enter><wait>",
+ "<enter><wait>", # vda
+ "Yes<enter><wait5s>",
+ "<enter><wait15s>", #disk size
+ "${var.vm_name}<enter><wait10s>",
+ "<enter><wait2s>",
+ "${var.ssh_password}<enter><wait>",
+ "${var.ssh_password}<enter><wait>",
+ "<enter><wait10s>", #vda
+ #"shutdown -h now<enter>"
+ "reboot now<enter><wait60s>",
+ "${var.ssh_username}<enter><wait>",
+ "${var.ssh_password}<enter><wait>",
+ ]
+
+ accelerator = "kvm"
+
+ iso_checksum = var.iso_checksum
+ #iso_url = fileexists(local.iso_path) ? local.iso_path : var.iso_url
+ iso_url = local.iso_path
+
+ boot_wait = var.boot_wait
+
+ http_directory = "http"
+
+ shutdown_command = "sleep ${var.sleep_before_shutdown}; sudo shutdown -P now"
+
+ communicator = "ssh"
+
+ host_port_min = var.host_port_min
+ host_port_max = var.host_port_max
+
+ ssh_username = var.ssh_username
+ ssh_password = var.ssh_password
+
+ ssh_timeout = "30m"
+
+ memory = var.memsize
+ cpus = var.numvcpus
+ disk_size = var.disk_size
+
+ vnc_port_min = var.vnc_port_min
+ vnc_port_max = var.vnc_port_max
+
+ headless = var.headless
+
+ output_directory = "${local.output_dir}"
+
+ net_device = "virtio-net"
+ disk_interface = "virtio"
+
+ qemuargs = [
+ ["-m", "2048"],
+ ["-smp", "4"],
+ ["-cpu", "host"],
+ ["-netdev", "user,id=user.0,", "hostfwd=tcp::{{ .SSHHostPort }}-:22"],
+ ["-device", "virtio-net,netdev=user.0"]
+ ]
+}
+
+build {
+ name = "vyos"
+
+ source "source.qemu.vyos" {
+ name = "vyos_qemu_qcow2"
+ vm_name = "${var.vm_name}-${source.name}.qcow2"
+ format = "qcow2"
+ }
+
+ # source "source.raw.vyos" {
+ # name = "vyos_qemu_raw"
+ # vm_name = "${var.vm_name}-${source.name}.raw"
+ # format = "raw"
+ # }
+
+
+ provisioner "shell-local" {
+ inline = [
+ "mkdir -p ${local.output_dir}"
+ ]
+ }
+
+ # preparing provisioner
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/init.sh",
+ ]
+ }
+
+ # installing apt repos and custom packages
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' CLOUD_INIT='${var.cloud_init}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/apt-repo-debian.sh",
+ "scripts/vyos/apt-repo-vyos.sh",
+ "scripts/vyos/apt-install.sh",
+ ]
+ }
+
+ # preparing cloud-init
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' CLOUD_INIT='${var.cloud_init}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/cloud-init-debian.sh",
+ "scripts/vyos/cloud-init-vyos.sh",
+ ]
+ }
+
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' PLATFORM='${var.platform}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/platform-qemu.sh"
+ ]
+ }
+
+ # cleanup before install
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/vyos-install-pre.sh",
+ ]
+ }
+
+ # install vyos on disk
+ # provisioner "shell" {
+ # execute_command = "VYOS_RELEASE='${var.vyos_release}' VM_NAME='${var.vm_name}' VM_PASSWORD='${var.ssh_password}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ # scripts = [
+ # "scripts/vyos/vyos-install.sh",
+ # ]
+ # }
+
+ # cleanup after install
+ provisioner "shell" {
+ execute_command = "VYOS_RELEASE='${var.vyos_release}' {{ .Vars }} sudo -E bash '{{ .Path }}'"
+ scripts = [
+ "scripts/vyos/vyos-install-post.sh",
+ ]
+ }
+
+ post-processor "checksum" {
+ checksum_types = ["sha256"]
+ keep_input_artifact = true
+ }
+
+ post-processors {
+ post-processor "shell-local" {
+ inline = [
+ "cp '${local.output_dir}/${var.vm_name}-${source.name}.qcow2' iso/${var.vm_name}.qcow2"
+ ]
+ #only = ["vyos_qemu_qcow2"]
+ }
+ }
+} \ No newline at end of file
diff --git a/vyos.pkrvars.hcl b/vyos.pkrvars.hcl
new file mode 100644
index 0000000..85a0540
--- /dev/null
+++ b/vyos.pkrvars.hcl
@@ -0,0 +1,19 @@
+
+
+# platform = "none" # will not install any specific platform
+# - qemu will install qemu-guest-agent
+platform = "qemu"
+
+# cloud-init values:
+# debian - will install/replace cloud-init packages
+# vyos - will keep cloud-init packages from vyos
+cloud_init = "debian"
+
+# if true configure grub to use serial console as default
+grub_serial = true
+
+# equuleus: debian 11 (branch 1.3.*)
+# sagitta: debian 12 (branch 1.4.*)
+# circinus: debian 12 (branch 1.5.*)
+# current: debian 12 (branch 1.5.*)
+vyos_release = "equuleus" \ No newline at end of file
diff --git a/vyos1.3.pkr.hcl b/vyos1.3.pkr.hcl
deleted file mode 100644
index 6610441..0000000
--- a/vyos1.3.pkr.hcl
+++ /dev/null
@@ -1,205 +0,0 @@
-
-packer {
- required_plugins {
- ansible = {
- version = "~> 1"
- source = "github.com/hashicorp/ansible"
- }
- }
-}
-
-
-variable "vm_name" {
- default = "vyos-1.3.6.img"
-}
-
-variable "numvcpus" {
- default = "4"
-}
-
-variable "memsize" {
- default = "2048"
-}
-
-variable "disk_size" {
- default = "10240"
-}
-
-
-variable "iso_url" {
- default = "vyos-1.3.6-amd64.iso"
-}
-
-variable "iso_filename" {
- default = "vyos-1.3.6-amd64.iso"
-}
-
-variable "iso_checksum" {
- default = "file:iso/SHA256SUM"
-}
-
-variable "ssh_username" {
- default = "vyos"
-}
-
-variable "ssh_password" {
- default = "vyos"
-}
-
-variable "boot_wait" {
- default = "5s"
-}
-
-locals {
- iso_path = "iso/${var.iso_filename}"
- timestamp_dir = "output-vyos-${regex_replace(timestamp(), "[: ]", "-")}"
-}
-
-source "qemu" "vyos" {
-
- boot_command = [
- "<enter>",
- "<wait60s>",
- "${var.ssh_username}<enter><wait>",
- "${var.ssh_password}<enter><wait>",
- "configure<enter><wait>",
- #"set interfaces ethernet eth0 address '10.210.240.9/24'<enter><wait>",
- #"set protocols static route 0.0.0.0/0 next-hop '10.10.10.1'<enter><wait>",
- "set interfaces ethernet eth0 address 'dhcp'<enter><wait>",
- "set system name-server '8.8.8.8'<enter><wait>",
- "set service ssh port '22'<enter><wait>",
- "commit<enter><wait>",
- "save<enter><wait>",
- "exit<enter><wait>",
- "install image<enter><wait3s>",
- "Yes<enter><wait>",
- "Auto<enter><wait>",
- "<enter><wait>", # vda
- "Yes<enter><wait5s>",
- "<enter><wait15s>", #disk size
- "${var.vm_name}<enter><wait10s>",
- "<enter><wait2s>",
- "${var.ssh_password}<enter><wait>",
- "${var.ssh_password}<enter><wait>",
- "<enter><wait10s>", #vda
- #"shutdown -h now<enter>"
- ]
- #boot_wait = "3s"
-
- vm_name = var.vm_name
- format = "qcow2"
-
- accelerator = "kvm"
-
- iso_checksum = var.iso_checksum
- iso_url = fileexists(local.iso_path) ? local.iso_path : var.iso_url
-
- boot_wait = var.boot_wait
-
- http_directory = "http"
-
- shutdown_command = "shutdown -P now"
-
- communicator = "ssh"
-
- #ssh_host = "10.18.0.37"
- #ssh_port = 3333
- #ssh_host_port_min = 2222
- #ssh_host_port_max = 2222
- #ssh_skip_nat_mapping = true
-
- ssh_username = var.ssh_username
- ssh_password = var.ssh_password
-
- ssh_timeout = "30m"
- #use_sudo = false
- #pause_before = "30s"
-
- memory = var.memsize
- cpus = var.numvcpus
-
- vnc_port_min = 5904
- vnc_port_max = 5904
- headless = false
-
- #guest_os_type = "Debian_64"
-
- output_directory = "output-vyos-${local.timestamp_dir}"
-
- net_device = "virtio-net"
- disk_interface = "virtio"
- disk_size = var.disk_size
-
- qemuargs = [
- ["-m", "2048"],
- ["-smp", "4"],
- ["-cpu", "host"],
- #["-netdev", "user,id=user.0,hostfwd=tcp:10.18.0.37:2222-10.10.10.2:22"],
- #["-netdev", "user,id=user.0,hostfwd=tcp::2222-:22"],
- #["-netdev", "bridge,id=br0,br=br0"],
- #["-netdev", "user,id=user.0"],
- #["-device", "virtio-net,netdev=user.0"],
-
- ["-netdev", "user,id=user.0,",
- "hostfwd=tcp::{{ .SSHHostPort }}-:22,",
- "net=10.210.240.0/24,",
- "dhcpstart=10.210.240.9",
- ""
- ],
- ["-device", "virtio-net,netdev=user.0"]
-
- ]
-}
-
-
-build {
- sources = [
- "source.qemu.vyos"
- ]
-
- provisioner "shell-local" {
- inline = [
- "mkdir -p ${local.timestamp_dir}"
- ]
- #only = ["qemu.vyos"]
- }
-
-# provisioner "shell" {
-# execute_command = "sh -c '{{ .Vars }} {{ .Path }}'"
-
-
-# # connection {
-# # type = "ssh"
-# # user = "vyos"
-# # password = "vyos"
-# # host = "127.0.0.1"
-# # port = 2222
-# # }
-
-# inline = [
-# "sleep 1000"
-# #"sudo apt update",
-# #"apt install -y nginx"
-# ]
-# }
-
-# provisioner "shell" {
-# execute_command = "sh -c '{{ .Vars }} {{ .Path }}'"
-
-# inline = [
-# #"apt -y update && apt -y upgrade",
-# #"sudo apt -y install python3-pip",
-# "sleep 10000"
-# #"pip3 --no-cache-dir install ansible"
-# ]
-# }
-}
-
-# provisioner "ansible-local" {
-# playbook_file = "scripts/setup.yml"
-# }
-
-# provisioner "shell" {
-# execute_command = "echo '${var.ssh_password}'|{{.Vars}} sudo -S -E bash '{{.Path}}'"
-# scripts = ["scripts/cleanup.sh"]
-# }