I would like to have a mechanism to set up a server automagically…
Similarly I would like to set up my user account settings (Tmux plugins, .zshrc and vim settings, etc) that I can replicate in multiple machines via a script (I have a custom script for this but I want a more solid alternative)
Thoughts on what infra-as-code solution would work best? Any similar experiences or use cases with one Thanks!
Cc @selfhost@lemmy.ml @selfhosted@lemmy.world
I think you’re looking for Ansible. Have fun!
The difference between an Anible playbook and a script, is Ansible has a ‘check’, ‘change’, ‘verify’ pattern, and is declarative (meaning that once the playbook is made, it tends to keep working on future versions of Ansible.)
Ehhh… as someone who does devops, you should dive into ansible core changelogs on github sometime ;)
I assume you mean to check on his often they’re is the breaking changes? :)
Declarative style isn’t perfect, but it’s a massive improvement from straight bash scripting.
💯
We’re an ansible shop and yeah it’s better than bash scripting (where it makes sense) but ansible… man it does have some peculiarities :/
I would like to have a mechanism to set up a server automagically…
NixOS.
Similarly I would like to set up my user account settings
Home-manager.
“I want to automatically build VMs, networks, and other infra in the cloud using repeatable specifications.”
Terraform
“I want to host my own cloud (either by paying for bare metal hosting, or providing my own) that I can deploy those VMs on.”
Openstack or Openshift
“I want to automatically configure servers after deployment.”
Ansible
“I want to deploy services to those servers in a simple, repeatable fashion.”
Docker, Podman, or Kubernetes.
deleted by creator
I completely agree. But I’m working from the assumption that if OP actually needs the ability to automatically provisions platforms, they’re probably working at a larger scale than the typical small self-hosted home server. And I like to give options.
IMO, the only tools here that most self hosters need are Docker, and maybe Ansible, though even that is a stretch because in most cases you’re just going to have one server running all your containers and that’s it.
It’s the whole “Cattle vs Pets” question. When you’re a typical self hoster, you’re probably better off just treating every server as a pet. But if you’re using self hosting as a way of building job skills (which is exactly how I broke into IT) then you absolutely want to start learning how to wrangle cattle.
Ansible is definitely one way to do this. If your machines are VMs, then also building VM images with packer can be the way.
For tmux, vim, etc. You can still use ansible or some specific tool for dotfiles, like chezmoi (there are a bunch). You can even use ansible to run chezmoi!
on top of ansible to setup system services and user accounts, I have found this https://github.com/andsens/homeshick to help getting my user settings back
I use https://www.chezmoi.io/ for the same purpose of managing dotfiles. There are a bunch of tools to do this that you can pick your poison :)
Make an ansible playbook
If it’s because you set new servers very frequently: Ansible
If it’s because moving stuff once every two years to a new server is an hassle: everything in custom docker images
If you don’t update your Docker images for two years or more you are going to have even more security holes than if you had it all on the host system and didn’t update that.
I build the docker images every time I call docker compose, they should be updated
There’s the huge bug that apparently they don’t want to fix, is that it caches “apt upgrade” so I have to edit that line every once in a while
One day I will update my script to add a random commented char at the end of that line every time
You’re probably looking for some sort of configuration management tool like chef, ansible, saltstack, or puppet. If you’re not already familiar with one, ansible is pretty easy to get started with.
If you’re also wanting something that can create the server itself, terraform is great and supports most cloud providers and supervisors.
Hey, please remember to tag your post! Thank you
Bare metal servers, VPSs, or VM’s you host? If it’s for VM’s you host, then consider Proxmox as hypervisor and use VM templates. I’m sure old school sysops could to the same with QEMU and Virtmanager or something. But basically, I just set up a VM exactly how I like it, then convert it to a template and cookie cutter it out.
I can sense the Nix guys shaking their heads - it’s on my list to try :- )
Isn’t that Docker?