Contents

Homelab - New setup

New setup for my homelab

In 2019 I bought a Raspberry PI to run telegram bots, a few scripts, and tools. This was my first experience in managing a Linux “server”!

Later on, I started managing a VPS with a friend of mine, then I started running Docker containers on it to avoid installing programs directly and to avoid the pain of adding PPA repositories. Then I met Kubernetes but I didn’t want to install it on the VPS to keep the VPS management simple and without a lot of overhead (yes, I still use docker-compose).

A few weeks later I got a refurbished mini PC (a sort of a NUC) for free so I decided to use it as a lab to learn and experiment with new technologies!

My setup

I actually have the mini PC but I would like to expand the project also for the Raspberry PI 3b+.

Mini PC’s specs:

Component Specs
CPU Intel Core i5 8th gen
Memory 16GB
Storage SSD NVMe 256GB but there’s a free SATA connector for a future HDD/SSD

VM Management

The mini PC isn’t too big but I aim to keep this project as cheap as possible so, to have multiple (virtual) hosts, I have to manage VMs. I decided to use Proxmox because it’s free, it exposes REST APIs so it can be scripted using Hashicorp’s tools, like Terraform and Packer.

I could have used ESXi, OpenStack, oVirt, and lots of other solutions but I didn’t want to add too much overhead and worry about things that should just work.

Let’s get started

Okay, I hope you are not bored at this point, yet. Here’s the practical part of the article: Proxmox’s installation

Proxmox

I installed Proxmox manually by connecting the mini PC to a monitor, a keyboard, and the LAN. The installation process is fully guided and documented.

This is a tip

Instead of connecting the node to external peripherals, you could try the following alternatives:

Node configuration

The node has some settings to be configured, so I created an Ansible role for the task.

This role will:

  • Upgrade packages
  • Disable the power button to avoid accidental power-offs
  • Change SSH port to ansible_port
  • Disable swap (required by k3s but can be disabled using disable_swap: no)
  • Set timezone (Default Europe/Rome)
  • Set hostname
  • Optional: enable automatic security upgrades (enable using unattended_upgrades: yes, default no)
Proxmox only

You need to disable proxmox’s enterprise repository before running the role.

Docs: Package repositories

Running the role

At this point, we have to setup ansible to run that role:

  1. Make sure you can connect to the proxmox role using SSH.

    SSH login info
    A passwordless authentication is preferred but there’s the possibility to fool ssh and use a password even in non-interactive mode using sshpass.
    This is a tip

    You can import your public keys from your GitLab or GitHub account by using curl:

    1
    
    curl https://gitlab.com/FedericoAntoniazzi.keys > .ssh/authorized_keys
    

  2. Clone my collection into your ansible collection directory

1
2
3
cd ~/.ansible/collections
mkdir federicoantoniazzi && cd "$_"
git clone https://gitlab.com/FedericoAntoniazzi/federicoantoniazzi.homelab homelab
  1. Create site.yml file with the following content
1
2
3
4
5
6
- hosts: all
  # Do not gather facts since it's required by ssh's tasks
  # Facts will be collected automatically once the role changed the default SSH port
  gather_facts: no
  roles:
    - federicoantoniazzi.homelab.system
  1. Define hosts in the hosts.yml file
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
all:
  children:
    proxmox:
      hosts:
        # Replace this with the IP address or the DNS name of the node
        192.168.1.240:
          hostname: pve
          ansible_user: root
          # Do not disable swap on Proxmox
          disable_swap: no
  1. Run the playbook
1
ansible-playbook -i hosts.yml site.yml

Conclusion

This project is just at its beginning and there are lots of ideas that I will share here.

Thank you for taking the time to read this post and feel free to contact me on Telegram, Matrix, LinkedIn, and so on… (links in the homepage) 😃