33 lines
769 B
Bash
Executable file
33 lines
769 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
CONFIG_DIR="$HOME/.config/dotfiles"
|
|
DOTFILES_DIR="$HOME/.dotfiles"
|
|
# TODO: Determine this automatically based on username or somehow.
|
|
IS_WSL=${IS_WSL:=false}
|
|
|
|
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() {
|
|
if [[ $IS_WSL ]]; then
|
|
ansible-playbook --diff --extra-vars "@${CONFIG_DIR}/values.yaml" --ask-become-pass "${DOTFILES_DIR}/main.yaml" --skip-tags skip-if-wsl "${@}"
|
|
else
|
|
ansible-playbook --diff --extra-vars "@${CONFIG_DIR}/values.yaml" --ask-become-pass "${DOTFILES_DIR}/main.yaml" "${@}"
|
|
fi
|
|
}
|
|
|
|
clone_or_update_dotfiles
|
|
install_dependencies
|
|
run_playbook
|