summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--willikins.vmdb49
-rw-r--r--willikins.yml70
2 files changed, 119 insertions, 0 deletions
diff --git a/willikins.vmdb b/willikins.vmdb
new file mode 100644
index 0000000..bca01af
--- /dev/null
+++ b/willikins.vmdb
@@ -0,0 +1,49 @@
+# This is a VMDB2 input file for willikins.
+
+steps:
+- mkimg: "{{ output }}"
+ size: 7G
+
+- mklabel: msdos
+ device: "{{ output }}"
+
+- mkpart: primary
+ device: "{{ output }}"
+ start: 0%
+ end: 100%
+ part-tag: root-part
+
+- mkfs: ext4
+ partition: root-part
+
+- mount: root-part
+ fs-tag: root-fs
+
+- unpack-rootfs: root-fs
+
+- debootstrap: stretch
+ mirror: http://deb.debian.org/debian
+ target: root-fs
+ unless: rootfs_unpacked
+
+- apt: install
+ packages:
+ - linux-image-amd64
+ fs-tag: root-fs
+ unless: rootfs_unpacked
+
+- chroot: root-fs
+ shell: |
+ apt-get -y install python
+ unless: rootfs_unpacked
+
+- cache-rootfs: root-fs
+ unless: rootfs_unpacked
+
+- ansible: root-fs
+ playbook: willikins.yml
+
+- grub: bios
+ root-fs: root-fs
+ root-part: root-part
+ device: "{{ output }}"
diff --git a/willikins.yml b/willikins.yml
new file mode 100644
index 0000000..dba3266
--- /dev/null
+++ b/willikins.yml
@@ -0,0 +1,70 @@
+- hosts: image
+ tasks:
+ - name: create policy-rc.d to stop daemons
+ copy:
+ content: "#!/bin/sh\nexit 101\n"
+ dest: /usr/sbin/policy-rc.d
+ owner: root
+ group: root
+ mode: 0755
+
+ - name: set /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: install sshd
+ apt:
+ name: ssh
+
+ - name: install sudo
+ apt:
+ name: sudo
+
+ - 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: allow passwordless sudo for ansible
+ copy:
+ content: "ansible ALL=(ALL:ALL) NOPASSWD: ALL"
+ dest: /etc/sudoers.d/ansible
+ owner: root
+ group: root
+ mode: 0600
+
+ - 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: remove policy-rc.d
+ file:
+ path: /usr/sbin/policy-rc.d
+ state: absent
+
+ vars:
+ hostname: willikins
+ 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