/dotfiles

Yep, I also can't believe I'm doing it this way.

Primary LanguagePythonMIT LicenseMIT

Dotfiles

Warm...warmer...disco.

Purpose

This repository uses ansible to install dotfiles and maintain package installations using OS managers. Currently, the default dotfiles configurations and package manifests are my own, and exist for MacOSX and Arch Linux. My sensitive vars files are separated by inventory group and encrypted with ansible-vault. The entrypoint playbook that specifies the role order is local.yml.

Vanilla Usage

Ansible Playbook

The inventory groups and roles are written in such a way where specifying --limit localhost bypasses the reading of vaulted material, providing for a generic configuration of various tools and OS-specific package installations.

# optional --vault-id id@/path/to/vault-password
# optional --ask-become-pass
ansible-playbook --limit localhost local.yml

Ansible Pull

The local.yml playbook can also be executed using ansible-pull by using the pull.yml playbook, which schedules the ansible-pull execution on a cron schedule, allowing for the upstream changes to propogate to the host in an eventually consistent manner. The underlying cron tool used varies by operating system: Arch Linux will rely on cronie, while Mac OSX will use the native launchd function.

# optional --vault-id id@/path/to/vault-password
# optional --ask-become-pass
ansible-playbook --limit localhost pull.yml

Configurations

Mac

Utilities

  • Creates a link to gpg-agent.conf in $HOME/.gnupg/gpg-agent.conf
  • Creates a link to htoprc in $HOME/.config/htoprc
  • Creates a link to tmux.conf in $HOME

Shell

Vim

  • Installs dein.vim plugin manager
  • Creates a link to vimrc in $HOME
  • Creates a link to init.vim in $HOME/.config/nvim

Advanced Usage

Ansible Playbook

For those who would enjoy configuring their workstation ssh configuration and gitconfig files, feel free to fork this repository and make modifications as needed. Under the default inventory, you'll note that aglorei is an example of how you'll need to setup your inventory and hostnames. The prerequisite requirements are:

  1. Ensure that machine hostname (output of hostname or hostname -s) is added as a host belonging to the group or to a subgroup of workstation.
  2. If added as a direct child to the workstation group, ensure a host_vars/$(hostname)/main.yml created. If added to a subgroup of workstation, ensure group_vars/$(subgroup)/main.yml is created. If needed, add / substitute for main_vault.yml variants for vaulted variables.
  3. Ensure that all vault_-prefixed variables in the workstation variable manifest is defined in the main.yml or main_vault.yml file for your hostname or group.

From here, the host variables are picked up by specifying --limit $(hostname):

# optional --vault-id id@/path/to/vault-password
# optional --ask-become-pass
ansible-playbook --limit $(hostname) local.yml

Ansible Pull

Similarly, you can again reverse the polarity of ansible's mode and setup a cron schedule to apply the configuration using your hostname variables:

# optional --vault-id id@/path/to/vault-password
# optional --ask-become-pass
ansible-playbook --limit $(hostname) pull.yml

Configurations

Git

SSH

  • Configure ~/.ssh/config
  • Configure ssh public and private keys with correct file modes