diff --git a/pillar.example b/pillar.example index ec48037..1d9cc97 100644 --- a/pillar.example +++ b/pillar.example @@ -75,6 +75,11 @@ users: options: - "StrictHostKeyChecking yes" + gitconfig: + user.name: B User + user.email: buser@example.com + url."https://".insteadOf: "git://" + google_2fa: True google_auth: ssh: | diff --git a/users/init.sls b/users/init.sls index b3145e0..28898e2 100644 --- a/users/init.sls +++ b/users/init.sls @@ -381,6 +381,25 @@ users_googleauth-{{ svc }}-{{ name }}: {%- endfor %} {%- endif %} +{% if 'gitconfig' in user %} +{% for key, value in user['gitconfig'].items() %} +users_{{ name }}_user_gitconfig_{{ loop.index0 }}: + {% if grains['saltversioninfo'] >= (2015, 8, 0, 0) %} + git.config_set: + {% else %} + git.config: + {% endif %} + - name: {{ key }} + - value: "{{ value }}" + - user: {{ name }} + {% if grains['saltversioninfo'] >= (2015, 8, 0, 0) %} + - global: True + {% else %} + - is_global: True + {% endif %} +{% endfor %} +{% endif %} + {% endfor %}