From f2f831670e995e932088e9cb47c4be5c9541c4f3 Mon Sep 17 00:00:00 2001 From: lif Date: Fri, 17 Oct 2025 15:40:01 +0100 Subject: [PATCH] Add packer file --- Makefile | 7 ------- image.pkr.hcl | 41 +++++++++++++++++++++++++++++++++++++++++ vagrant/Vagrantfile | 1 - 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 image.pkr.hcl diff --git a/Makefile b/Makefile index 4684dd5..b6f6f71 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,3 @@ -setup: - cd vagrant && vagrant plugin install vagrant-disksize - list: vagrant status up: @@ -22,10 +19,6 @@ ansible-stack: ansible-full: make ansible-master && make ansible-workers && make ansible-stack -setup-keys: - mkdir -p ./keys - ssh-keygen -t ed25519 -f ./keys/access -N "" -q - ansible-watch: find ./ansible -type f | entr -p make ansible-master diff --git a/image.pkr.hcl b/image.pkr.hcl new file mode 100644 index 0000000..60b5567 --- /dev/null +++ b/image.pkr.hcl @@ -0,0 +1,41 @@ +packer { + required_plugins { + virtualbox = { + version = ">= 1.0.0" + source = "github.com/hashicorp/virtualbox" + } + } +} + +variable "disk_size" { + type = string + default = "20480" # 20 GB in MB +} + +source "virtualbox-iso" "ubuntu" { + iso_url = "https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso" + iso_checksum = "SHA256:...fill_in_checksum..." + ssh_username = "vagrant" + ssh_password = "vagrant" + ssh_wait_timeout = "20m" + disk_size = var.disk_size + guest_os_type = "Ubuntu_64" + vm_name = "packer-ubuntu" +} + +build { + name = "ubuntu20-vagrant" + sources = ["source.virtualbox-iso.ubuntu"] + + provisioner "shell" { + inline = [ + "sudo apt-get update", + "sudo apt-get install -y vim git curl" + ] + } + + post-processor "vagrant" { + output = "ubuntu20-vagrant.box" + } +} + diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index dc70a2f..5117dc7 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -55,7 +55,6 @@ Vagrant.configure('2') do |config| node_config.vm.hostname = node[:hostname] node_config.vm.box = 'debian/bullseye64' # node_config.vm.disk :disk, size: '32GB', primary: true - node_config.disksize.size = "50GB" # node_config.vm.synced_folder "./data", "/vagrant_data" # node_config.vm.box_version = "20250415.336224"