The Problem 🤕
Wait... before I share the problem with you, I first need to make sure that you're on the right machine. I assume you are on Linux or macOS, as I am not so sure if this plays well with Windows.
So, what's the problem we're trying to solve here?
As the title should already suggest, the idea is to configure and manage your system and dotfiles with Ansible (yes, you heard it correctly) and not GNU Stow.
But why go through all this, right? Well, setting up a system is usually a one-time thing and not something you have to do over and over, when you mostly stick with one system.
But wait... what if you suddenly need to? Like, you've got two different machines, maybe one macOS and one Linux, or even two of the same kind, or you need to set up your office computer just the way you like it.
Now, do you see the pain that you might have to go through?
The Solution
At the very least, managing your dotfiles is super important. If you are not already managing them properly, you're doing things really wrong, my friend.
There's two different efficient ways of handling this:
1. GNU Stow
With stow, you're mainly talking about "managing system and dotfiles," system management is completely out of play.
Most folks don't really care about automating system management and just prefer managing dotfiles, and that's perfectly fine. You'll find tons of different videos on YT explaining how to do it.
Here's the video that sold Stow to me a year ago:
I've been using this method for over a year to handle my dotfiles, and you can check out my "Stow" way of managing dotfiles here: Link
But, this is not the focus for this blog, let's continue to Ansible...
2. Ansible
When you think of Ansible, you probably think of a tool for managing systems. But guess what? You can totally use it to handle your dotfiles too.
So, how did I come up with the idea to use Ansible for managing my system and dotfiles?
It wouldn't be fair if I didn't mention TechDufus. His setup really looked slick and mine configuration is highly based on his.
You can check out my repository here: Link
Everything's managed by Ansible, so if you know the basics, it's pretty easy to follow.
Here's the setup in action where I set up two fresh Ubuntu machines with my configuration:
Conclusion
With this setup, you can not only manage your dotfiles but also set up a new machine just the way you like it, including all the packages you need, with just one command.
Once you get the hang of this setup, I bet you won't need anything else anytime soon, since it even takes care of system management, which was something GNU Stow couldn't do.
My configuration is still new, and I'm working on tweaking the workflow to use Ansible.
Feel free to drop any suggestions or let me know if I'm missing something! ✌️
Top comments (28)
I've been using stow for dotfiles management. I don't manage a lot of tools myself. It's been working pretty solid. System management isnt really needed for me as I usually work with Windows.
Thank you for sharing this idea of using Ansible for dotfiles management by the way!
That's the way!!
🔥
Thanks, Nabin! 🙌
Glad you enjoyed this one.
I use stow with a small shell script to install packages I like, depending on OS. It's like, "do we have pacman? Do we have apt? is there a dumb
Applications
directory you need magic powers to access?" and then "install list-of-stuff".Yeah, stow is pretty solid and does almost all the work and combined with sh as you said, that's the way it's supposed to be. And with this new setup that I have with Ansible, it's pretty much the same but the "Ansible" way yk.
BTW, it's good to see you here, man. 🙌
This looks awesome. I store my config on github and no other tool.
I'm curious to about this
Thank You, @williamdk 🙌
Let me know if you give this a shot!
Try this out and let me know how it goes for you!
Pretty cool seeing someone actually wrangle dotfiles and system setup like this - you think most people ever stick with one config, or are we all just endlessly tweaking forever?
Thank you, Nevo! I don't know about anybody else, but for me, my dotfiles change every 2-3 days with just a little tweak. I'm never satisfied with one config. 😂
That sounds like a solid setup! Leveraging a dotfiles repo combined with something like Ansible for full system provisioning is a huge step up from just using GNU Stow—it brings real automation and reproducibility to your environments. It's especially handy when spinning up new machines or VMs, whether locally or in the cloud.
Here are a few suggestions you might consider as you refine your workflow:
Modular Ansible Roles: Break your setup into reusable roles (e.g., dev-tools, terminal, neovim, etc.) so you can apply them selectively based on the machine type (e.g., dev machine vs. server).
Use Tags in Ansible: This allows you to run only certain parts of your playbook (e.g., --tags "dotfiles" or --tags "packages"), which makes testing and updates much easier.
Secrets Management: If you need to manage sensitive data (like SSH keys, API tokens), consider integrating tools like Ansible Vault or sops.
Cross-Platform Support: If you're using both Linux and macOS (or even WSL), you could structure your playbooks to adapt per platform with when: conditions.
CI for Dotfiles: You could even use GitHub Actions or another CI to lint/test your Ansible playbooks or even do dry runs on containerized environments to catch issues before you apply them.
You're on the right path. Once it’s dialed in, a single command to bootstrap your entire environment is a massive time-saver
Managing your development environment across multiple machines can quickly become messy — especially when you have dozens of tools, configurations, and preferences. That’s why I use Ansible to manage my system setup and dotfiles in a clean, repeatable, and version-controlled way.
Kadaich sathiii!! 😍
Thank you, my friend! 🤗
Share your thoughts in the comments! :D
Here's the post on Reddit: reddit.com/r/ansible/comments/1k9x...
This can backfire. I don't think Ansible has all the modules that you might require in the future to manage your system. But, this is a great approach to solving the issue at hand. 👍
Thank you! There's shell support, though, which I think should be enough to get just what I want, even if there's no module support for it.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.