During the last years, also the underlying server setup becomes more and more complex with a lot of services and their configuration.
Now, I rebuild everything from scratch using ansible and vagrant. It is a fully automated solution to install and configure my server. Just to give you a quick impression. It is based on ~340 ansible tasks.
If you want to know more about it, I tried to document it here.
Great writeup! Thanks for the hard work. Wondering if you can share the part list for your wall mounted display. The micro usb connector on the tablet looks useful. Also curious to know which Traco you used.
Thank you @holger_hees for sharing your work, I got interested in setup-automation as it looks like a very good solution for “system backup” that allows easy upgrade and change of entire system. If something goes wrong, options for changing the hardware/os/system become much flexible, in theory. It is basically as if you have installed a all your components from scratch, on a brand new system.
One question if you do not mind, how difficult/often is it to handle some errors?
Typical example is that some installation fails, due to some strange dependency not being loaded or what not. Do you rollback entire VM then, and run entire script, or just update few steps and try again?
Also if you need to change something after initial setting up, f.eks. open few ports etc, would you update original script, or append new tasks etc? Meaning, how easy is to maintain changes, do you need good understanding of Ansible to do it?
I never used ansible before, so curious if time invested in it initially but also maintaining it is worth it
Thanks!
@dakipro This was also my intention. This is now my system backup.
and you can handle errors very easy. I use the Vagrant script to create or update my “test / staging” virtual machine. Means, vagrant will create a virtual machine if it does not exists or will start a already existing virtual machine. At the end it will run the ansible script inside to install and configure the system. Later you can also run the ansible script by yourself to apply updates if you made changes to the configuration. If anything goes wrong in case of an error (Most of the cases are network issues where an external server are not reachable) ansible can continue at any point. Just rerun the script. In my case, I use Vagrant to test everything and call ansible directly on my production machine.
One thing you should keep in mind. You must be more strict if you make changes to your system. You should never configure your system directly. All changes should happen inside the ansible configurations and ansible applies them to the server.
There are 2 place where you should take a look. The first one is the config folder. It contains variables for usernames, password, file pathes, ports etc. The second one is the role folder. It contains ansible rules which contains the logic how to setup and install individual parts.
As now, my ansible setup is quite complex now it takes a while to run. Minimum is 8 Minutes just to check if everything is fine. A full server installation needs 20 minutes. But you can also run individual tasks like “e.g. just nextcloud config” if you know what is updatet and should be checked or applied
I see that your vagrant runs on openSUSE, I guess it is not just as easy to go for some other distribution, like Ubuntu? (some things are probably specific to openSUSE?)
Through to be told, I suck in any of linux systems, but I used ubuntu before, so I guess it would be a few variables less for me, not sure…
While I do not yet have dedicated server for virtual machines, I decided to spin one up on my workstation and play/prepare for the time when the migration of openhab from laptop to dedicated server comes
You have to adapt my configuration anyway. So my deployment setup is just a playground to see how everything works together. What is possible and which services are useful.
You can also change the used distribution from openSUSE to ubuntu in the vagrant file and see whats happen. I guess it is less work than expected and it will improve your linux skills.
I just wanted to update on the progress, and thank you again for sharing your work @holger_hees as it has saved me A LOT of time getting started with ansible and vagrant.
Your code is very good example on what one might need on a home automation server and an excellent starting point for getting started with virtualization.
I started with last ubuntu server box in vagrant, and am slowly integrating ansible tasks into it. Most differences from your script/suse is packaging manager and elevating the privileges (basically a lot of googling). But you are right, I am learning a lot about linux and services I am installing. And being able to just tear down a vm and build it in minutes with vagrant and ansible is a mind blowing experience, as it would take hours/weeks doing it manually (i’ve reinstalled windows waaay to many times, really tired of it).
I really love the idea of configuring what I want system to be in a file, and being able to quickly (and reliably) reproduce it over and over and over again. I hope Ansible will live up to the expectations in practice.
I just want to thank you @holger_hees about this very usefull exemple of usage Ansible with openHAB and system.
All is a big good work !
Great ! Will start with your methods and will try to adapt it in my side.
Just wondering if someone do the exercice to implement Docker instead of Vagrant.