From 5390e77716980b841dc3b35afbcd7a279e5fb3d7 Mon Sep 17 00:00:00 2001 From: Oliver Davies <oliver@oliverdavies.uk> Date: Wed, 30 Mar 2022 23:41:06 +0100 Subject: [PATCH] feat: add `dotfiles` script --- bin/dotfiles | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/dotfiles diff --git a/bin/dotfiles b/bin/dotfiles new file mode 100755 index 00000000..2d2cf966 --- /dev/null +++ b/bin/dotfiles @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +DOTFILES_DIR="$HOME/.dotfiles" + +clone_or_update_dotfiles() { + git -C $DOTFILES_DIR pull +} + +install_dependencies() { + ansible-galaxy install -r "${DOTFILES_DIR}/requirements.yml" +} + +run_playbook() { + # TODO: automatically skip roles if the playbook is run within WSL. + ansible-playbook --diff --ask-become-pass "${DOTFILES_DIR}/main.yaml" "${@}" +} + +clone_or_update_dotfiles +install_dependencies +run_playbook