Build of ISOs, execution of the debian-installer in qemu and deployment with Ansible:
M4 usage heavily inspired by http://bobbynorton.com/posts/includes-in-dockerfiles-with-m4-and-make/
Debian Preseed
Debian Preseed is a mean to completely automate the debian-installer steps. There are several ways to setup the debian installer “preseeding”. The one I choose is to edit the netboot ISO image in order to include my installer configuration.
- The preseed.cfg creates a hands off installation with the following features:
- Swiss keyboard and locale
- GPT partioning
- No swap
- Sudo without password for users in the sudo group
Feel free to adapt to your needs!
To rebuild the ISO images, make sure you’ve Docker installed and type:
make
- This will download the debian installer ISO image, modify it and provide 2 ISO:
- debian-preseed-server.iso -> the available disk space is assigned mostly to /var
- debian-preseed-standard.iso -> the available disk space is assigned mostly to /
To use the ISO:
sudo dd if=debian-preseed-server.iso of=<put the device matching the USB key you just plugged>
Warning
this will erase the entire content of the USB key.
Warning
the debian installer will not ask any question -> it will erase completely the first drive of the machine to install debian.
Testing the iso locally
- To test the iso, first make sure you have KVM / Qemu and a vncviewer installed. You can then run:
- make test_iso in one terminal: this will start QEMU in background and wait for the full installation to finish by connecting with SSH inside the resulting installation
- vncviewer localhost:59000 to see the process in action
Ansible
Ansible is the ultimate IT automation tool. test_ansible.sh fetches the roles using ansible-galaxy. Then, it calls ansible-playbook on the freshly installed debian image.
- As a demonstration, the following roles are applied (see demo.yml):
- ansible_debian : configure non-free, install firmwares and configure locales
- ansible_debian/roles/users : configure the user accounts
- ansible_debian/roles/docker : install docker
- ansible_debian/roles/docker_portainer : deploy Portainer to easily manage the containers locally
- ansible_debian/roles/groups : Add users to groups
This is just an example how easy it is to deploy fully automatically a debian system.
Have fun!