diff options
-rw-r--r-- | minimal.vmdb | 47 | ||||
-rw-r--r-- | minimal.yml | 23 |
2 files changed, 70 insertions, 0 deletions
diff --git a/minimal.vmdb b/minimal.vmdb new file mode 100644 index 0000000..bc915d6 --- /dev/null +++ b/minimal.vmdb @@ -0,0 +1,47 @@ +# A vmdb2 image specification file for a minimal VM image that can be +# administered via Ansible. Root access directly via ssh. + +steps: + - mkimg: "{{ output }}" + size: 4G + + - mklabel: msdos + device: "{{ output }}" + + - mkpart: primary + device: "{{ output }}" + start: 0% + end: 100% + tag: / + + - kpartx: "{{ output }}" + + - mkfs: ext4 + partition: / + + - mount: / + + - unpack-rootfs: / + + - debootstrap: buster + mirror: http://deb.debian.org/debian + target: / + unless: rootfs_unpacked + + - apt: install + packages: + - linux-image-amd64 + - python + - ssh + tag: / + unless: rootfs_unpacked + + - cache-rootfs: / + unless: rootfs_unpacked + + - ansible: + playbook: minimal.yml + + - grub: bios + tag: rootfs + console: serial diff --git a/minimal.yml b/minimal.yml new file mode 100644 index 0000000..1765119 --- /dev/null +++ b/minimal.yml @@ -0,0 +1,23 @@ +hosts: image +tasks: + - name: disable root password + chroot: | + passwd -l root + + - name: set hostname in /etc/hostname and /etc/hosts + chroot: | + echo "{{ hostname }}" > /etc/hostname + sed -i 's/^127\.0\.1\.1/& localhost {{ hostname }}' /etc/hosts + + - name: install root ssh authorized_keys + authorized_key: + user: root + state: present + key: "{{ root_authorized_keys }}" + + - name: enable eth0 network interface + copy: + content: | + auto eth0 + iface eth0 inet dhcp + dest: /etc/network/interfaces.d/eth0 |