feat(git): configure local settings
This commit is contained in:
parent
5390e77716
commit
dd14486223
|
@ -2,19 +2,24 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
CONFIG_DIR="$HOME/.config/dotfiles"
|
||||||
DOTFILES_DIR="$HOME/.dotfiles"
|
DOTFILES_DIR="$HOME/.dotfiles"
|
||||||
|
|
||||||
clone_or_update_dotfiles() {
|
clone_or_update_dotfiles() {
|
||||||
git -C $DOTFILES_DIR pull
|
git -C $DOTFILES_DIR pull
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_config_dir() {
|
||||||
|
mkdir -p "${CONFIG_DIR}"
|
||||||
|
}
|
||||||
|
|
||||||
install_dependencies() {
|
install_dependencies() {
|
||||||
ansible-galaxy install -r "${DOTFILES_DIR}/requirements.yml"
|
ansible-galaxy install -r "${DOTFILES_DIR}/requirements.yml"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_playbook() {
|
run_playbook() {
|
||||||
# TODO: automatically skip roles if the playbook is run within WSL.
|
# 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
|
clone_or_update_dotfiles
|
||||||
|
|
|
@ -15,3 +15,8 @@
|
||||||
- .gitconfig
|
- .gitconfig
|
||||||
- .gitignore-global
|
- .gitignore-global
|
||||||
- .gitmessage
|
- .gitmessage
|
||||||
|
|
||||||
|
- name: Local configuration
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: gitconfig.local.j2
|
||||||
|
dest: "{{ ansible_user_dir }}/.gitconfig.local"
|
||||||
|
|
3
roles/git/templates/gitconfig.local.j2
Normal file
3
roles/git/templates/gitconfig.local.j2
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[user]
|
||||||
|
email = {{ git_user_email }}
|
||||||
|
name = {{ git_user_name }}
|
Loading…
Reference in a new issue