Ansible module to manage KDE's configuration through kconfig
I've been managing my devices since 2015, starting out with a make file and a bunch of symlinks, then a collection of bash scripts. In 2017 I graduated onto Puppet, before landing on Ansible in late 2018, where I still am today.
Since my State of the Apps 2023, I've been slowly moving my desktop usage from i3 over to KDE. Whilst i3 was trivial to configure as a text file, KDE is less-so. KDE uses KConfig (not to be confused with Kconfig), which helps application developers store configuration for their apps (eg Plasma), in a way which is capable of storing complex datatypes easily. It's still text, and looks a lot like INI, but wow it's verbose!
Fortunately for me, KDE provide some command-line tooling to manually modify the KConfig files (which tend to live in
~/.config), in the form of
$ kwriteconfig5 --group "KDE" --key "AnimationDurationFactor" "0.5"
With Ansible, you can easily run any command-line tool as part of your playbooks, but making the tasks idempotent (ie they don't always report as "changed") is more complex.
Instead, I wanted something more Ansible-native, and having never built a custom Ansible module before, I thought "how hard could it be"?
As it turns out, not very.
ansible-kconfig is an Ansible module (packaged as a Collection) which allows simple writing (and reading, if you're so inclined) of KConfig configuration, in a reasonable safe manner. With this, and a little trial-and-error, the vast majority of my KDE setup is now configured with Ansible. The most complicated part is the panels, as my monitor setup is different between machines, but Latte dock might be a better choice here anyway.
Yes, yes, I'm well aware NixOS exists.