diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-04-11 14:29:42 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-04-11 14:29:42 +0300 |
commit | 41af91c531a1131797b13b5fa7ae4a15b9904b74 (patch) | |
tree | 5e20303d41063a1f45499a238155a9b0f485bd7a /base-image | |
parent | e1ddba6b2afe9a34b6aeaafeeb06847ec9f8ad32 (diff) | |
download | ansibleness-41af91c531a1131797b13b5fa7ae4a15b9904b74.tar.gz |
Move base image files into sub-directory
Diffstat (limited to 'base-image')
-rw-r--r-- | base-image/base-image.yml | 10 | ||||
-rwxr-xr-x | base-image/bullseye-vm.sh | 13 | ||||
-rw-r--r-- | base-image/bullseye-vm.vmdb | 50 |
3 files changed, 73 insertions, 0 deletions
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 |