From 41af91c531a1131797b13b5fa7ae4a15b9904b74 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 11 Apr 2022 14:29:42 +0300 Subject: Move base image files into sub-directory --- base-image/base-image.yml | 10 +++++++++ base-image/bullseye-vm.sh | 13 ++++++++++++ base-image/bullseye-vm.vmdb | 50 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 base-image/base-image.yml create mode 100755 base-image/bullseye-vm.sh create mode 100644 base-image/bullseye-vm.vmdb (limited to 'base-image') diff --git a/base-image/base-image.yml b/base-image/base-image.yml new file mode 100644 index 0000000..5f72de6 --- /dev/null +++ b/base-image/base-image.yml @@ -0,0 +1,10 @@ +- hosts: image + tasks: + - apt: + name: + - cloud-init + - openssh-server + - locales-all + vars: + hostname: bullseye + ansible_python_interpreter: /usr/bin/python3 diff --git a/base-image/bullseye-vm.sh b/base-image/bullseye-vm.sh new file mode 100755 index 0000000..b40229e --- /dev/null +++ b/base-image/bullseye-vm.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -euo pipefail + +tarball="$1" + +sudo vmdb2 bullseye-vm.vmdb \ + --output bullseye-vm.img \ + --log bullseye-vm.log \ + --rootfs-tarball "$tarball" \ + --verbose + +qemu-img convert -f raw -O qcow2 bullseye-vm.img bullseye-vm.qcow2 diff --git a/base-image/bullseye-vm.vmdb b/base-image/bullseye-vm.vmdb new file mode 100644 index 0000000..9b1eda8 --- /dev/null +++ b/base-image/bullseye-vm.vmdb @@ -0,0 +1,50 @@ +steps: + - mkimg: "{{ output }}" + size: 4G + + - mklabel: msdos + device: "{{ output }}" + + - mkpart: primary + device: "{{ output }}" + start: 0% + end: 50% + tag: / + + - kpartx: "{{ output }}" + + - mkfs: ext4 + partition: / + + - mount: / + + - unpack-rootfs: / + + - debootstrap: bullseye + mirror: http://deb.debian.org/debian + target: / + unless: rootfs_unpacked + + - apt: install + packages: + - linux-image-amd64 + tag: / + unless: rootfs_unpacked + + - cache-rootfs: / + unless: rootfs_unpacked + + - chroot: / + shell: | + apt -y install python3 parted acpi + + - fstab: / + + - resize-rootfs: / + + - ansible: / + playbook: base-image.yml + + - grub: bios + tag: / + quiet: false -- cgit v1.2.1