nix-config/bin/dotfiles
Oliver Davies 7ee57545ce feat(*): allow for filtering the playbook by role
Allow for appending ansible-playbook arguments to the dotfiles script,
and automatically applying tags to the included roles.

For example:

`./bin/dotfiles --tags=neovim`
2022-04-20 21:45:45 +01:00

26 lines
499 B
Bash
Executable file

#!/bin/bash
set -e
CONFIG_DIR="$HOME/.config/dotfiles"
DOTFILES_DIR="$HOME/.dotfiles"
clone_or_update_dotfiles() {
git -C $DOTFILES_DIR pull
}
create_config_dir() {
mkdir -p "${CONFIG_DIR}"
}
install_dependencies() {
ansible-galaxy install -r "${DOTFILES_DIR}/requirements.yml"
}
run_playbook() {
ansible-playbook --diff --extra-vars "@${CONFIG_DIR}/values.yaml" --ask-become-pass "${DOTFILES_DIR}/main.yaml" "${@}"
}
clone_or_update_dotfiles
install_dependencies
run_playbook "${@}"