Role is used to automate installation and setup of chezmoi on macOS, Ubuntu and Debian systems.
If you like/use this role, please consider starring it. Thanks!
Dotfile managers give you the combined benefit of a consistent environment everywhere with an undo command and a restore from backup.
As the core of our development environments become increasingly standardized (e.g. using git at both home and work), and we further customize them, at the same time we increasingly work in ephemeral environments like Docker containers, virtual machines, and GitHub Codespaces.
In the same way that nobody would use an editor without an undo command, or develop software without a version control system, chezmoi brings the investment that you have made in mastering your tools to every environment that you work in.
When I decided to develop a role for my dotfiles I did some research over existing dotfile managers. Chezmoi has a great comparison table over other managers. Check this comparison table.
- Homebrew: Requires
homebrew
already installed (you can usewayofdev.homebrew
to install it on your macOS). - Up-to-date version of ansible. During maintenance/development, we stick to ansible versions and will use new features if they are available (and update
meta/main.yml
for the minimum version). - Compatible OS. See compatibility table.
- Role has dependencies on third-party roles on different operating systems. See
requirements.yml
and dependencies section.
Available variables are listed below, along with example values (see defaults/main.yml
):
# From where should we take dotfiles?
# Example repository: "https://github.com/benmezger/dotfiles"
# By default, my personal is used.
dotfiles_repository_url: "https://github.com/lotyp/dotfiles.git"
dotfiles_repository_branch: master
---
- hosts: all
# is needed when running over SSH
environment:
- PATH: "/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:{{ ansible_env.PATH }}"
roles:
- wayofdev.homebrew
- wayofdev.dotfiles
To install dependencies and start development you can check contents of our Makefile
Install poetry using poetry-bin and all dev python dependencies:
$ make install
Install only python dependencies, assuming that you already have poetry:
$ make install-deps
Install all git hooks:
$ make hooks
Lint all role files:
$ make lint
You can check Makefile
to get full list of commands for remote and local testing. For local testing you can use these comands to test whole role or separate tasks:
β οΈ Notice: By defaut all tests are running against your local machine!
# run molecule tests on localhost
$ poetry run molecule test --scenario-name default-macos-on-localhost -- -vvv
# or with make command
$ make m-local
# choose which tags will be included
$ export TASK_TAGS="dotfiles-install,dotfiles-configure"; make m-local
# runs molecule with docker driver
$ poetry run molecule test --scenario-name default -- -vvv
# or with make file
$ make m-linux
# run molecule scenarios against remote machines over SSH
# this will need VM setup and configuration
$ poetry run molecule test --scenario-name default-macos-over-ssh -- -vvv
$ make m-remote
# tags also can be passed
$ export TASK_TAGS="dotfiles-install,dotfiles-configure"
$ make m-remote
Installation handled by Makefile
and requirements are defined in requirements.yml
This role has been tested on these systems:
system / container | tag |
---|---|
macos | monterey |
macos | big-sur |
ubuntu | latest |
debian | latest |
This role was created in 2022 by lotyp / wayofdev.