diff --git a/roles/git/client/tasks/main.yml b/roles/git/client/tasks/main.yml index 0e2c8bc..b14c78f 100644 --- a/roles/git/client/tasks/main.yml +++ b/roles/git/client/tasks/main.yml @@ -6,21 +6,17 @@ state: installed - name: create git config for sh based shells - copy: + template: dest: /etc/profile.d/git.sh - content: | - export GIT_AUTHOR_EMAIL="${USER}@{{ mail_domain }}" - export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}" + src: git.sh.j2 mode: 0644 owner: root group: root - name: create git config for csh based shells - copy: + template: dest: /etc/profile.d/git.csh - content: | - setenv GIT_AUTHOR_EMAIL "${USER}@{{ mail_domain }}" - setenv GIT_COMMITTER_EMAIL "${GIT_AUTHOR_EMAIL}" + src: git.csh.j2 mode: 0644 owner: root group: root diff --git a/roles/git/client/templates/git.csh.j2 b/roles/git/client/templates/git.csh.j2 new file mode 100644 index 0000000..fe769c5 --- /dev/null +++ b/roles/git/client/templates/git.csh.j2 @@ -0,0 +1,6 @@ +if ( "`git config user.name`" == "" ) then + git config --global user.name "`getent passwd '${USER}' | cut -d : -f 5`" +endif +if ( "`git config user.email`" == "" ) then + git config --global user.email "${USER}@foo.sh" +endif diff --git a/roles/git/client/templates/git.sh.j2 b/roles/git/client/templates/git.sh.j2 new file mode 100644 index 0000000..d696124 --- /dev/null +++ b/roles/git/client/templates/git.sh.j2 @@ -0,0 +1,6 @@ +if [ -z "$(git config user.name)" ]; then + git config --global user.name "$(getent passwd "$USER" | cut -d : -f 5)" +fi +if [ -z "$(git config user.email)" ]; then + git config --global user.email "${USER}@{{ mail_domain }}" +fi