From dd1448622330891df572e7041c58e8be69024ac1 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 30 Mar 2022 23:58:01 +0100 Subject: [PATCH] feat(git): configure local settings --- bin/dotfiles | 7 ++++++- roles/git/tasks/main.yaml | 5 +++++ roles/git/templates/gitconfig.local.j2 | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 roles/git/templates/gitconfig.local.j2 diff --git a/bin/dotfiles b/bin/dotfiles index 2d2cf96..911ee5a 100755 --- a/bin/dotfiles +++ b/bin/dotfiles @@ -2,19 +2,24 @@ 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() { # TODO: automatically skip roles if the playbook is run within WSL. - ansible-playbook --diff --ask-become-pass "${DOTFILES_DIR}/main.yaml" "${@}" + ansible-playbook --diff --extra-vars "@${CONFIG_DIR}/values.yaml" --ask-become-pass "${DOTFILES_DIR}/main.yaml" "${@}" } clone_or_update_dotfiles diff --git a/roles/git/tasks/main.yaml b/roles/git/tasks/main.yaml index 415c583..e620f34 100644 --- a/roles/git/tasks/main.yaml +++ b/roles/git/tasks/main.yaml @@ -15,3 +15,8 @@ - .gitconfig - .gitignore-global - .gitmessage + +- name: Local configuration + ansible.builtin.template: + src: gitconfig.local.j2 + dest: "{{ ansible_user_dir }}/.gitconfig.local" diff --git a/roles/git/templates/gitconfig.local.j2 b/roles/git/templates/gitconfig.local.j2 new file mode 100644 index 0000000..9e0e4dd --- /dev/null +++ b/roles/git/templates/gitconfig.local.j2 @@ -0,0 +1,3 @@ +[user] +email = {{ git_user_email }} +name = {{ git_user_name }}