blog.cyrusroshan.com

24 October 2020

No. 7

My home infrastructure setup with Ansible

Having a home server has many benefits:

  • Spotify-connected speakers πŸ”ˆ
  • wifi printing πŸ–¨
  • automated laptop backups over wifi πŸ’Ώ
  • and more! 😱

And you might find this useful, when you have:

  • unused speakers
  • a wired, usb-only printer
  • and a laptop that hasn't been backed up in a year

And I did. And I had an unused Raspberry Pi I could use as a home server. But I kept procrastinating on setting it up.

Because I knew that not only did I have to do a lot of initial configuration, I'd have to repeat the entire process if my server's storage failed. And Paspberry Pis use SD cards, which have a reputation for higher failure rates.

Of course, there are software solutions to this. They're all some form of configuration and deployment, and I'd loosely categorize them into three areas:

Each has their merits, and these are just a subset of the tools that exist.

For my home setup, I opted for Ansible. I did this because I:

  1. don't want to host anything
  2. want a fairly simple solution
  3. can easily change Ansible to ansible-pull, if I want devices to pull updates from a git repo
  4. don't care about dockerβ€”I won't be using a variety of architectures or OSes (I just have a few Pis)
  5. can easily figure out the IP of all of my Pis and connect to them directly (a requirement, for Ansible)

This solved my problems, and even though though it took a bit of extra time to set things up with Ansible, it was maybe 2-3x the time it'd take me to run the plain bash commands. And setting up my second Raspberry Pi was much faster as a result.

My config sets up the following:

  • SSH via your public key instead of password
  • ZSH/ohmyzsh set up with Agnoster as the default theme when you SSH in
  • Spotifyd set up (just plug in a speaker and you've got Wifi speakers)
  • Hostnames match your pi's inventory name

And I've made it open source. Here it is on Github, feel free to fork it for your personal setup.

Get new indie blog posts in your mailbox, personally written by me