summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base.vmdb48
-rw-r--r--base.yml61
-rwxr-xr-xbuild-all.sh8
-rw-r--r--minimal.vmdb46
-rw-r--r--minimal.yml23
5 files changed, 74 insertions, 112 deletions
diff --git a/base.vmdb b/base.vmdb
deleted file mode 100644
index e1633b6..0000000
--- a/base.vmdb
+++ /dev/null
@@ -1,48 +0,0 @@
-# This is a VMDB2 input file for a BIOS booting system, including most
-# virtual machines. The goal is to have a system that can be managed
-# via Ansible.
-
-steps:
- - mkimg: "{{ output }}"
- size: 8G
-
- - mklabel: msdos
- device: "{{ output }}"
-
- - mkpart: primary
- device: "{{ output }}"
- start: 0%
- end: 100%
- tag: rootfs
-
- - kpartx: "{{ output }}"
-
- - mkfs: ext4
- partition: rootfs
- label: rootfs
-
- - mount: rootfs
-
- - unpack-rootfs: rootfs
-
- - debootstrap: stretch
- mirror: http://deb.debian.org/debian
- target: rootfs
- unless: rootfs_unpacked
-
- - apt: install
- packages:
- - linux-image-amd64
- - python
- tag: rootfs
- unless: rootfs_unpacked
-
- - cache-rootfs: rootfs
- unless: rootfs_unpacked
-
- - ansible: rootfs
- playbook: base.yml
-
- - grub: bios
- tag: rootfs
- console: serial
diff --git a/base.yml b/base.yml
deleted file mode 100644
index bed3790..0000000
--- a/base.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-- hosts: image
- tasks:
- - name: set hostname in /etc/hostname
- copy:
- content: "{{ hostname }}"
- dest: /etc/hostname
- owner: root
- group: root
- mode: 0600
-
- - name: add hostname to /etc/hosts
- lineinfile:
- dest: /etc/hosts
- regexp: '^127\.0\.1\.1'
- line: "127.0.0.1 {{ hostname }}"
-
- - name: remove password for root
- shell: |
- sed -i 's/^root:x:/root::/' /etc/passwd
-
- - name: add ansible user
- user:
- name: ansible
- comment: "Ansible config mangement"
- shell: /bin/bash
-
- - name: add ssh key to ansible authorized keys
- authorized_key:
- user: ansible
- state: present
- key: "{{ ssh_key_for_ansible }}"
-
- - name: add dhcp client to eth0
- copy:
- content: |
- auto eth0
- iface eth0 inet dhcp
- dest: /etc/network/interfaces.d/eth0
- owner: root
- group: root
- mode: 0644
-
- - name: install sshd
- apt:
- name: ssh
-
- - name: install sudo
- apt:
- name: sudo
-
- - name: allow passwordless sudo for ansible
- copy:
- content: "ansible ALL=(ALL:ALL) NOPASSWD: ALL"
- dest: /etc/sudoers.d/ansible
- owner: root
- group: root
- mode: 0600
-
- vars:
- hostname: stretch-amd64
- ssh_key_for_ansible: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDAlECa3tbFGXhB3Zh/4/GhM11THOThVfiuLqqJ2dpWHEClzpKJHpzzwWt7g9z/MMQNMsUJLy+okz+De6hdjjmYJ9kG9Sr3H4YKq6itGQMj7L/cH3WS3ynp0uy0oW3hf932vDZKQ8iy9vczXH+ERYl+4TYae1Jp4Hyf4/2IYxEfuhKctvSvqySST3Qk9JNZ71HFGOWhjH/MmoCLoT1v+HkqmHdYf/GMKGRo3gqCEGgCgNErYYIyKm3OF3dHXK+hyGLE/cZNu6fU5woW3rvtUCFt08Ri2pm0cnXXJn9jQIMxfS5Kkf64svwgzKmPqgX1f4flopYPlsBXduCgzbJvj+lpgauAk/i1A5B01CFa9sI4C6pHZmwk1qxRwN+4IXL2CQt+tDgYC84ZDDd8R7cNyL22a3KhMQmdHtvog1beAa3Ab+J+cafkXXN+Es9f1wQjzk7DiHupmJIVofBvPP+cRcB46rwha6ati8Fa5QkT9rXFNqQsKk7jq8TIi54Bm15OOa0jInGG3TM17b9Ftu2WTJSAaqgBnDfZiInK7HEvC6K/IBljrN3oGagmFZPrAvzw7d6C2/nKFAQtfoMcE5oWVDrJyjsmJ8oaru0E8rwj7mMvyKPgEMnXTGXLWDgEo50+i291m4bkCxVwiOPbPRvdMll1Y8qfBAPT76sY4Ikgcw/2iw== openpgp:0xBBE80E50
diff --git a/build-all.sh b/build-all.sh
index fca81a3..3551558 100755
--- a/build-all.sh
+++ b/build-all.sh
@@ -7,12 +7,14 @@ image()
local img="$1"
local tarball="$2"
- vmdb2 base.vmdb \
+ vmdb2 minimal.vmdb \
--output "$img" \
--verbose \
--log base.log \
--rootfs-tarball "$tarball"
- xz -v1T0 "$img"
+# xz -v1T0 "$img"
}
-image debian9-ick.img "/home/liw/tmp/debian9.tar.gz"
+tarballs="$1"
+
+image debian-buster.img "$tarballs/debian-amd64-buster.tar.gz"
diff --git a/minimal.vmdb b/minimal.vmdb
new file mode 100644
index 0000000..3a30e31
--- /dev/null
+++ b/minimal.vmdb
@@ -0,0 +1,46 @@
+# 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: /
diff --git a/minimal.yml b/minimal.yml
new file mode 100644
index 0000000..8fd485a
--- /dev/null
+++ b/minimal.yml
@@ -0,0 +1,23 @@
+- hosts: image
+
+ tasks:
+ - name: disable root password
+ shell: |
+ passwd -l root
+
+ - 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
+
+ vars:
+ root_authorized_keys: |
+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDAlECa3tbFGXhB3Zh/4/GhM11THOThVfiuLqqJ2dpWHEClzpKJHpzzwWt7g9z/MMQNMsUJLy+okz+De6hdjjmYJ9kG9Sr3H4YKq6itGQMj7L/cH3WS3ynp0uy0oW3hf932vDZKQ8iy9vczXH+ERYl+4TYae1Jp4Hyf4/2IYxEfuhKctvSvqySST3Qk9JNZ71HFGOWhjH/MmoCLoT1v+HkqmHdYf/GMKGRo3gqCEGgCgNErYYIyKm3OF3dHXK+hyGLE/cZNu6fU5woW3rvtUCFt08Ri2pm0cnXXJn9jQIMxfS5Kkf64svwgzKmPqgX1f4flopYPlsBXduCgzbJvj+lpgauAk/i1A5B01CFa9sI4C6pHZmwk1qxRwN+4IXL2CQt+tDgYC84ZDDd8R7cNyL22a3KhMQmdHtvog1beAa3Ab+J+cafkXXN+Es9f1wQjzk7DiHupmJIVofBvPP+cRcB46rwha6ati8Fa5QkT9rXFNqQsKk7jq8TIi54Bm15OOa0jInGG3TM17b9Ftu2WTJSAaqgBnDfZiInK7HEvC6K/IBljrN3oGagmFZPrAvzw7d6C2/nKFAQtfoMcE5oWVDrJyjsmJ8oaru0E8rwj7mMvyKPgEMnXTGXLWDgEo50+i291m4bkCxVwiOPbPRvdMll1Y8qfBAPT76sY4Ikgcw/2iw== openpgp:0xBBE80E50