From ec52eb098fa62bc2a27da78294bc42ee78a40164 Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
Date: Mon, 28 Mar 2022 02:26:20 +0300
Subject: [PATCH] Update packer build and use smaller BIOS boot partition

- Create packer builder in FSN1 and change image to ubuntu-20.04
- Add "use_proxy: false" to provisioner config to work around [1]
- Reduce the size of the BIOS boot partition to 1M (from 10M) [2]
- Update bootstrap_version to 2022.03.01

[1] https://github.com/hashicorp/packer-plugin-ansible/issues/69
[2] https://www.gnu.org/software/grub/manual/grub/html_node/BIOS-installation.html
---
 packer/archlinux.json             | 7 ++++---
 playbooks/tasks/install_arch.yml  | 2 +-
 roles/install_arch/tasks/main.yml | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/packer/archlinux.json b/packer/archlinux.json
index 6cc390aeb..06c8eaf36 100644
--- a/packer/archlinux.json
+++ b/packer/archlinux.json
@@ -10,16 +10,17 @@
             "custom_image": "archlinux"
         },
         "token": "{{ user `hetzner_cloud_api_key` }}",
-        "image": "ubuntu-18.04",
+        "image": "ubuntu-20.04",
         "server_type": "cx11",
         "ssh_username": "root",
-        "location": "nbg1",
+        "location": "fsn1",
         "rescue": "linux64"
     }],
     "provisioners": [{
         "type": "ansible",
         "playbook_file": "playbooks/tasks/install_arch.yml",
         "host_alias": "packer-base-image",
-        "inventory_directory": "."
+        "inventory_directory": ".",
+        "use_proxy": false
     }]
 }
diff --git a/playbooks/tasks/install_arch.yml b/playbooks/tasks/install_arch.yml
index 752f78c56..7021a4b58 100644
--- a/playbooks/tasks/install_arch.yml
+++ b/playbooks/tasks/install_arch.yml
@@ -9,5 +9,5 @@
   roles:
     - install_arch
   vars:
-    - bootstrap_version: "2021.04.01"
+    - bootstrap_version: "2022.03.01"
     - sshd_enable_includes: false
diff --git a/roles/install_arch/tasks/main.yml b/roles/install_arch/tasks/main.yml
index bc6049afa..e18abe617 100644
--- a/roles/install_arch/tasks/main.yml
+++ b/roles/install_arch/tasks/main.yml
@@ -14,7 +14,7 @@
   when: ansible_facts['os_family'] == "Alpine"
 
 - name: create GRUB embed partitions
-  command: sgdisk -g --clear -n 1:0:+10M {{ item }} -c 1:boot -t 1:ef02
+  command: sgdisk -g --clear -n 1:0:+1M {{ item }} -c 1:boot -t 1:ef02
   with_items:
     - "{{ system_disks }}"
   register: sgdisk
-- 
GitLab