Replies: 1 comment 3 replies
-
I don't know if it will unclutter it for you, but I've been using a layered approach using multiple chezmoi sources and/or repos for situations of "some-common-some-different". When there is too much divergance, then I would prefer a separate repo, yet I still want the convinience of chezmoi. The cost however, is to CONTEXT switch between the differnt sources. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been using chezmoi for a while now, expanding my dotfiles for all of my Linux hosts up until a few days ago. Recently I started adding my Windows dotfiles aswell and my dotfiles repo is really starting to become cluttered now and I'm kind of losing sight of what stuff gets added to which host.
I began using
.chezmoidata
to set some distro specific defaults for hosts and added a per-hostname config for very host specific settings. It now looks like this:The
arch_*.yaml
files contain distro specific variables, like which packages shall be installed by default, the package manager used and which tools like nvm, oh-my-zsh, sdkman etc. need certain prerequisite packages installed, like this:And the
host_*.yaml
files contain host specific configurations:And the
machine.yaml.tmpl
merges all this information for the current host like this:Which can be included in a dotfile template with a single line in the header of a file:
This allows me to query machine specific data to ignore specific files via .chezmoiignore and only apply certain configs to specific types of hosts, like this for the .chezmoiignore:
Or I can enable p10k in my .zshrc:
Where the $machine.tools.p10k.fg_color is set to orange for Ubuntu so the zsh on my Ubuntu servers is orange, while Manjaro uses the default green theme and EndeavourOS is violet.
To install the packages I use a script that leverages this setup:
With this setup I can set up a new host, add a yaml for it to my .chezmoidata configs and initialize the host with my dotfiles via chezmoi init easily. But I am not yet sure if stuff like installing packages etc. should be done through chezmoi. I'd rather use Ansible for managing the host itself. While I am satisfied with this setup, I think it is not perfect and I need some inspiration on how I could improve this.
How do you manage lots of machines? Are you only using templates or do you have a more generic approach?
Beta Was this translation helpful? Give feedback.
All reactions