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.
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
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
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:
- Ensure that machine hostname (output of
hostname
orhostname -s
) is added as a host belonging to the group or to a subgroup ofworkstation
. - If added as a direct child to the
workstation
group, ensure ahost_vars/$(hostname)/main.yml
created. If added to a subgroup ofworkstation
, ensuregroup_vars/$(subgroup)/main.yml
is created. If needed, add / substitute formain_vault.yml
variants for vaulted variables. - Ensure that all
vault_
-prefixed variables in the workstation variable manifest is defined in themain.yml
ormain_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
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