Ansible role to manage dotfiles using a bare Git repository.
Automatises the technique described in The best way to store your dotfiles: A bare Git repository.
The technique consists in storing a Git bare repository in a "side" folder (like $HOME/.cfg or $HOME/.myconfig) using a specially crafted alias so that commands are run against that repository and not the usual .git local folder, which would interfere with any other Git repositories around.
$ ansible-galaxy install jan_matthis.git_dotfiles
# Dotfiles repository
git_dotfiles_repo: "https://github.com/jan-matthis/dotfiles.git"
# Alias to manage dotfiles
git_dotfiles_alias: "cfg"
# Directory for dotfiles
git_dotfiles_dir: "{{ ansible_env.HOME }}"
# Directory for .git/ of dotfiles repository
git_dotfiles_dir_dot_git: "{{ ansible_env.HOME }}/.cfg/"
# Directory for backup files
git_dotfiles_dir_backup: "{{ ansible_env.HOME }}/.config-backup"
# File in which alias gets defined, empty string to not set it
git_dotfiles_alias_file: "{{ ansible_env.HOME }}/.aliases"
- hosts: servers
include_role:
name: jan_matthis.git_dotfiles
vars:
git_dotfiles_url: "https://github.com/jan-matthis/dotfiles.git"
Tests can be run using molecule
and docker
.
MIT