From 55eb2a6a558629f03a9a3114fe4060c75228a2f2 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sat, 16 Nov 2019 11:56:45 +0000 Subject: [PATCH] Add template for host-specific git configuration --- dotfiles.yml | 7 +++++++ roles/git/files/config | 3 ++- roles/git/tasks/main.yml | 5 +++++ roles/git/templates/config.host.j2 | 9 +++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 roles/git/templates/config.host.j2 diff --git a/dotfiles.yml b/dotfiles.yml index fd67526..b0a0cda 100644 --- a/dotfiles.yml +++ b/dotfiles.yml @@ -1,6 +1,13 @@ --- - name: Set up development machine hosts: localhost + vars_prompt: + - name: git_user + private: no + default: Fernando Schauenburg + - name: git_email + private: no + default: fernando@schauenburg.me roles: - packages - bin diff --git a/roles/git/files/config b/roles/git/files/config index 7cfbb6f..7af5964 100644 --- a/roles/git/files/config +++ b/roles/git/files/config @@ -80,4 +80,5 @@ required = true [include] - path = ~/.config/git/config.local + path = ~/.config/git/config.host # host-specific (from template) + path = ~/.config/git/config.local # optional manual configurations diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 4228cd4..ba92a3f 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -25,6 +25,11 @@ - config - ignore +- name: Deploy git host-specific config + template: + src: config.host.j2 + dest: ~/.config/git/config.host + - name: Create bin directory for additional git commands file: path: ~/.local/bin diff --git a/roles/git/templates/config.host.j2 b/roles/git/templates/config.host.j2 new file mode 100644 index 0000000..33f5074 --- /dev/null +++ b/roles/git/templates/config.host.j2 @@ -0,0 +1,9 @@ +[user] + name = {{ git_user }} + email = {{ git_email }} + +{% if ansible_os_family == 'Darwin' %} +[credential] + helper = osxkeychain +{% endif %} +