diff options
-rw-r--r-- | ansible/inventory-pub.yml | 10 | ||||
-rw-r--r-- | hash/debian10/generate-scripts.yml | 44 | ||||
-rw-r--r-- | hash/debian10/preseed.cfg.j2 | 86 | ||||
-rw-r--r-- | hash/debian10/vimscore-4/authorized_keys | 2 | ||||
-rw-r--r-- | hash/debian10/vimscore-4/preseed.cfg | 86 | ||||
-rwxr-xr-x | hash/debian10/vimscore-4/run-install | 16 |
6 files changed, 244 insertions, 0 deletions
diff --git a/ansible/inventory-pub.yml b/ansible/inventory-pub.yml new file mode 100644 index 0000000..2a88d9a --- /dev/null +++ b/ansible/inventory-pub.yml @@ -0,0 +1,10 @@ +all: + hosts: + knot: + ansible_host: trygvis.io + birgitte: + ansible_host: vs.trygvis.io + arius: + ansible_host: arius.trygvis.io + akili: + ansible_host: localhost diff --git a/hash/debian10/generate-scripts.yml b/hash/debian10/generate-scripts.yml new file mode 100644 index 0000000..be2976c --- /dev/null +++ b/hash/debian10/generate-scripts.yml @@ -0,0 +1,44 @@ +- hosts: localhost + connection: local + vars: + vm_name: vimscore-4 + vm_domain: vimscore.com + authorized_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBz/VF9JwHdlYbxoU25UONod8/lB7J81WKXkgcHIZ5up trygvis@hash + tasks: + - file: + path: "{{ vm_name }}" + state: directory + + - copy: + dest: "{{ vm_name }}/run-install" + mode: a+rx + content: | + #!/bin/bash + name={{ vm_name }} + virt-install -n "$name" \ + --memory {{ memory|default(2048) }} \ + --vcpus=1 \ + --os-variant=debian10 \ + --disk path=/var/lib/libvirt/images/"${name}".qcow2,size=10 \ + --location http://deb.debian.org/debian/dists/stable/main/installer-amd64/ \ + --extra-args "hostname=${name} interface=auto " \ + --network network=default \ + --noautoconsole \ + --initrd-inject=authorized_keys \ + --initrd-inject=preseed.cfg \ + -v \ + --debug \ + 2>&1 | tee virt.txt + + - template: + dest: "{{ vm_name }}/preseed.cfg" + src: preseed.cfg.j2 + + - copy: + dest: "{{ vm_name }}/authorized_keys" + content: | + # Generated for virt-install + {% for key in authorized_keys %} + {{ key }} + {% endfor %} diff --git a/hash/debian10/preseed.cfg.j2 b/hash/debian10/preseed.cfg.j2 new file mode 100644 index 0000000..c262089 --- /dev/null +++ b/hash/debian10/preseed.cfg.j2 @@ -0,0 +1,86 @@ +#_preseed_V1 +# +# https://www.debian.org/releases/stable/amd64/apbs04.en.html +# + +d-i debian-installer/country string NO +d-i debian-installer/keymap select no +d-i debian-installer/language string en_US:en +d-i debian-installer/locale string en_US + +#d-i localechooser/supported-locales string en_US.UTF-8 nb_NO.UTF-8 + +d-i keyboard-configuration/layoutcode string no +d-i keyboard-configuration/variantcode string +d-i keyboard-configuration/xkb-keymap select no + +d-i netcfg/choose_interface select auto + +d-i netcfg/get_hostname string {{ vm_hostname|default(vm_name) }} +d-i netcfg/get_domain string {{ vm_domain }} +d-i netcfg/hostname string {{ vm_hostname|default(vm_name) }}.{{ vm_domain }} + +d-i mirror/country string manual +d-i mirror/protocol string http +d-i mirror/http/directory string /debian +d-i mirror/http/hostname string deb.debian.org +d-i mirror/http/proxy string +d-i mirror/suite string stable + +d-i hw-detect/load_firmware boolean false +d-i netcfg/wireless_wep string + +# A literal "!" disabled the password for root/the user. Can be hard-coded with a crypt(3) hash. +d-i passwd/root-login boolean false +d-i passwd/root-password-crypted password ! + +d-i passwd/make-user boolean false + +d-i passwd/user-fullname string Foo +d-i passwd/username string foo +d-i passwd/user-password string foo +d-i passwd/user-password-again string foo +#d-i passwd/user-password-crypted password ! + +d-i time/zone string Europe/Oslo +d-i clock-setup/ntp boolean true + +d-i partman-auto/method string regular +#d-i partman-auto-lvm/guided_size string max +d-i partman-auto/choose_recipe select atomic + +# https://www.bishnet.net/tim/blog/2015/01/29/understanding-partman-autoexpert_recipe/ +# https://github.com/xobs/debian-installer/blob/master/doc/devel/partman-auto-recipe.txt +# One single, huge partition. No swap. +d-i partman-auto/expert_recipe string \ + root :: \ + 1024 1000000000 -1 ext4 \ + $primary{ } $bootable{ } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . +d-i partman-basicfilesystems/no_swap boolean false + +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +popularity-contest popularity-contest/participate boolean true +tasksel tasksel/first multiselect standard, ssh-server + +d-i base-installer/install-recommends boolean false +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true + +#d-i grub-installer/only_debian boolean true +#d-i grub-installer/with_other_os boolean true +d-i grub-installer/bootdev string default + +d-i finish-install/keep-consoles boolean true +d-i finish-install/reboot_in_progress note + +d-i preseed/late_command string \ + mkdir /target/root/.ssh ;\ + cp /authorized_keys /target/root/.ssh/ diff --git a/hash/debian10/vimscore-4/authorized_keys b/hash/debian10/vimscore-4/authorized_keys new file mode 100644 index 0000000..a78e63c --- /dev/null +++ b/hash/debian10/vimscore-4/authorized_keys @@ -0,0 +1,2 @@ +# Generated for virt-install +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBz/VF9JwHdlYbxoU25UONod8/lB7J81WKXkgcHIZ5up trygvis@hash diff --git a/hash/debian10/vimscore-4/preseed.cfg b/hash/debian10/vimscore-4/preseed.cfg new file mode 100644 index 0000000..143c943 --- /dev/null +++ b/hash/debian10/vimscore-4/preseed.cfg @@ -0,0 +1,86 @@ +#_preseed_V1 +# +# https://www.debian.org/releases/stable/amd64/apbs04.en.html +# + +d-i debian-installer/country string NO +d-i debian-installer/keymap select no +d-i debian-installer/language string en_US:en +d-i debian-installer/locale string en_US + +#d-i localechooser/supported-locales string en_US.UTF-8 nb_NO.UTF-8 + +d-i keyboard-configuration/layoutcode string no +d-i keyboard-configuration/variantcode string +d-i keyboard-configuration/xkb-keymap select no + +d-i netcfg/choose_interface select auto + +d-i netcfg/get_hostname string vimscore-4 +d-i netcfg/get_domain string vimscore.com +d-i netcfg/hostname string vimscore-4.vimscore.com + +d-i mirror/country string manual +d-i mirror/protocol string http +d-i mirror/http/directory string /debian +d-i mirror/http/hostname string deb.debian.org +d-i mirror/http/proxy string +d-i mirror/suite string stable + +d-i hw-detect/load_firmware boolean false +d-i netcfg/wireless_wep string + +# A literal "!" disabled the password for root/the user. Can be hard-coded with a crypt(3) hash. +d-i passwd/root-login boolean false +d-i passwd/root-password-crypted password ! + +d-i passwd/make-user boolean false + +d-i passwd/user-fullname string Foo +d-i passwd/username string foo +d-i passwd/user-password string foo +d-i passwd/user-password-again string foo +#d-i passwd/user-password-crypted password ! + +d-i time/zone string Europe/Oslo +d-i clock-setup/ntp boolean true + +d-i partman-auto/method string regular +#d-i partman-auto-lvm/guided_size string max +d-i partman-auto/choose_recipe select atomic + +# https://www.bishnet.net/tim/blog/2015/01/29/understanding-partman-autoexpert_recipe/ +# https://github.com/xobs/debian-installer/blob/master/doc/devel/partman-auto-recipe.txt +# One single, huge partition. No swap. +d-i partman-auto/expert_recipe string \ + root :: \ + 1024 1000000000 -1 ext4 \ + $primary{ } $bootable{ } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . +d-i partman-basicfilesystems/no_swap boolean false + +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +popularity-contest popularity-contest/participate boolean true +tasksel tasksel/first multiselect standard, ssh-server + +d-i base-installer/install-recommends boolean false +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true + +#d-i grub-installer/only_debian boolean true +#d-i grub-installer/with_other_os boolean true +d-i grub-installer/bootdev string default + +d-i finish-install/keep-consoles boolean true +d-i finish-install/reboot_in_progress note + +d-i preseed/late_command string \ + mkdir /target/root/.ssh ;\ + cp /authorized_keys /target/root/.ssh/ diff --git a/hash/debian10/vimscore-4/run-install b/hash/debian10/vimscore-4/run-install new file mode 100755 index 0000000..2b76c64 --- /dev/null +++ b/hash/debian10/vimscore-4/run-install @@ -0,0 +1,16 @@ +#!/bin/bash +name=vimscore-4 +virt-install -n "$name" \ + --memory 2048 \ + --vcpus=1 \ + --os-variant=debian10 \ + --disk path=/var/lib/libvirt/images/"${name}".qcow2,size=10 \ + --location http://deb.debian.org/debian/dists/stable/main/installer-amd64/ \ + --extra-args "hostname=${name} interface=auto " \ + --network network=default \ + --noautoconsole \ + --initrd-inject=authorized_keys \ + --initrd-inject=preseed.cfg \ + -v \ + --debug \ + 2>&1 | tee virt.txt |