17 minutes
Setting Up a Worker for Home Lab
Home Lab
My home lab setup currently consists of a single “worker” (where I run portainer and all of my containers for the services my home needs) and a small Ubiquity setup. I serves me well and I am very please with it so far. I wanted to start to spin up some more containers and also test some thing out and figure it would be a good idea to add some more resources to the pool. I was about to hook up my desk setup to the new worker and I thought that I would really like if this was automated…
Steps to Automate to Add a Worker to the Lab
- Get MAC address of the NIC
- Reserve IP address and associate MAC address on DHCP server
- Add DNS entries pointing at the new worker
- Netboot worker with CentOS
- Ansible playbook run to hammer worker into the desired state
- Move newly built worker into physical location (not sure how to automate this safely yet 😀)
- Add docker socket on the new worker to the current portainer instance
Get MAC address of the NIC
Manual
I cabled up the new worker to my desktop switch and waited a few seconds for him to show up on my network and then used a fixed address and renamed him.
Automated
Reserve IP address and associate MAC address on DHCP server
Manual
Then I chose an alias for him and allowed the IP to be reserved on the DHCP server.
Automated
Add DNS Entries Pointing at the New Worker
Manual
I am using an awesome dnsmasq container that has a cute go wrapper to serve a UI for the config. At the bottom of the config I just add something like this:
|
Bash |
Automated
Netboot Worker with CentOS
Manual
In order to work on the build I decided that I would just install via USB while I am still setting up the environment and tools to have a worker bootstrapping environment.
Automated
Ansible Playbook Run to Hammer Worker Into the Desired State
Manual
In order to know what packages and settings I needed I figured that I would just ssh over to the newly built host and then start setting it up. I would record all the steps and things I wanted to change and then look for existing playbook on Ansible Galaxy for it. If it was there I would pull that module down to my repo (maybe as a submodule or subtree). If I couldn’t find it then I would just build it up myself – hopefully it would something that could be helpful to someone else.
Install VIM
Need a real editor so I first need to grab vi
|
Bash |
Disable SELinux
|
Bash |
|
Bash |
Add my preferred user
|
Bash |
Add sudo permission to my user
|
Bash |
Install docker
Using the instructions from docker itself. Adding some needed tools:
|
Bash |
Adding the docker repo
|
Bash |
Install docker
|
Bash |
Finally I would add my ssh-key to the newly built host:
|
Bash |
Disable firewall
|
Bash |
Automated
Move Newly built Worker Into Physical Location
Manual
I just carried the little guy over there:
Automated
Add Docker Socket On the New Worker to the Current Portainer Instance
Manual
Now I just head over to portainer and added a new docker API endpoint and done.
Automated
In the next couple posts I will go over automating these steps and then try it all out on worker3.