Kickstart and Ansible setup of my homeserver.
I am running my homeserver for quite some time, but wanted to automate it for a while now. Recently a friend reached out and asked me to provide some kind of documentation. So, I created this repository and a blog series about it.
The description provided here, should be reproducible without any further explanation, but it is expected, that you already have some knowledge, when it comes to installing an operating system and using Ansible. In case, you want to learn more about some of the used technologies and software, I reommend having a look at the below list of articles and work your way from there.
- Fedora - Home Server Series
- Kickstart - Getting Started
- Spotlight - Fedora Server
- Git - Getting Started
- Ansible - Getting Started
- Podman - Getting Started
After having the home server in place, you can also check out other guides, that may give an idea how you can put some workload on your server.
The result of the below configurations is a Home Server, that can be used for self-hosting, experimenting with new services and home services. It provides a web interface, container and virtual machine capabilities and some useful services for a home lab.
The pre-configured software includes podman, kvm, Cockpit, Performance Co-Pilot and many more.
For testing purposes, you need an x86_64 machine/virtual machine with at least the below specifications:
- CPU: Intel Core CPU with 2 Cores
- Memory: 2 GB
- Disk: 20 GB
- Network: 1 Gb LAN
For a production setup, the below specifications are recommended:
- CPU: Intel Core CPU with 4 Cores
- Memory: 4 GB
- Disk: 200 GB
- Network: 1 Gb LAN
Before you can start with the installation, you need to download the Fedora Server Netinstll image from the website and create an USB media.
You can use the Fedora Media Writer and/or follow the detailed instructions.
Fedora Media Writer is also available for Windows and MacOS.
I am using Kickstart for the initial deployment of my homeserver. Kickstart automates all the steps needed in the installer and you can also provide additional packages, scripts and files.
There are 2 Kickstart files in this repository:
- base_ks.cfg is a general home server setup, that can be used in a VM for testing purposes.
- full_ks.cfg is the automation I am using for my personal setup. The configuration takes care of customized partitioning, password settings and some additional configuration.
For this guide, I will stick to the base_ks.cfg, but feel free to check out the other one, too. The installation will do the below steps for you.
- Create a user and password
- Partition disk 1
- Set the timezone to UTC
- Set the keyboard layout to US
- Set the language to en_US
- Install packages
- core
- Cockpit
- Ansible
Starting an installation via Kickstart is pretty easy:
- Boot from USB media
- At the below screenshot, interrupt the boot sequence by hitting a key and editing the first entry.
- Add
inst.ks=https://your.kickstart.url/path/to/ks.cfg
like shown below: - Continue and the installer will do its work.
- Wait until the system is rebooted and login with the default credentials.
- user: admin
- pass: password
After the succesful installation, you can configure the machine and install additional software via Ansible as explained in the next section.
Instead of providing and maintaining an inventory, I decided to use a manifest.yml. This makes customizing the Ansible Playbook easier and straight forward.
Just change it to your liking and run the playbook as described in the above sections. Each option is documented in the "manifest.yml".
If you want to configure the behaviour with an inventory instead, you can do this, too. You can read more about Ansible inventories in another blog article and the upstream documentation.
The Ansible Playbook "configure.yml" can be used on basically every Fedora Linux Server installation. It will:
- Configure the hostname and timezone
- Install and configure chrony (NTP)
- Install and configure some CLI tools
- Install and configure tuned (power profiles)
- Install and configure Avahi (mDNS provider)
- Install and configure Cockpit (Admin Web UI)
- Install and configure Performance Co-Pilot (performance metrics system)
- Install and configure KVM and libvirt
- Configure a bridge network for the virtual machines
To apply the playbook, you just need to run it from your workstation.
# Run the playbook (dry-run)
$ ansible-playbook -i IP_ADDRESS, --check --diff ansible/playbooks/configure.yml
# Run the playbook (for real)
$ ansible-playbook -i IP_ADDRESS, ansible/playbooks/configure.yml
Additionally, the Ansible Playbook "update.yml" can be used to keep your machine updated. It will:
- Update the system
- Reboot if necessary
You can apply it the same way as the "configure.yml" playbook.
# Run the playbook (dry-run)
$ ansible-playbook -i IP_ADDRESS, --check ansible/playbooks/update.yml
# Run the playbook (for real)
$ ansible-playbook -i IP_ADDRESS, ansible/playbooks/update.yml
I am not a fan of auto-updates (downloading updates is fine, though) and the playbook will ensure that you can update and reboot whenever you feel comfortable.
In case you are using the virtualization, I have provided a playbook to create Virtual Maschines. It will prompt you for some information and create the VM.
# Create a VM
$ ansible-playbook -i IP_ADDRESS, ansible/playbooks/create_vm.yml
Afterwards, you will be able to log in to the new machine.
In case you want to deploy containers via Podman on your home server, you can have a look at the example playbook deploy_hello_container.yml.
# Create hello-world container
$ ansible-playbook -i IP_ADDRESS, ansible/playbooks/deploy_hello_container.yml
As an example, but also for some real world usage of the home server, this repository includes the below deployments:
Except otherwise noted, all work is licensed under a BSD-3-Clause License.
Please feel free to reach out to me to provide feedback or get in touch.
- Site: https://while-true-do.io
- Blog: https://blog.while-true-do.io
- Code: https://github.com/dschier-wtd
- Mail: [email protected]