git: template .gitconfig
This commit is contained in:
17
roles/git/defaults/main.yml
Normal file
17
roles/git/defaults/main.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
|
||||
git_user: your-username
|
||||
git_email: your-email@example.com
|
||||
git_signkey:
|
||||
git_signingkey:
|
||||
git_do_sign: false
|
||||
|
||||
git_user_home: "/home/{{ git_system_user }}"
|
||||
git_system_user: "{{ git_user }}"
|
||||
git_system_group: "{{ git_system_user }}"
|
||||
|
||||
git_gpg_program: ~
|
||||
|
||||
git_aliases: []
|
||||
|
||||
git_credentials: []
|
9
roles/git/tasks/main.yml
Normal file
9
roles/git/tasks/main.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
|
||||
- name: Template .gitconfig
|
||||
template:
|
||||
src: gitconfig.j2
|
||||
dest: "{{ git_user_home }}/.gitconfig"
|
||||
owner: "{{ git_system_user }}"
|
||||
group: "{{ git_system_group }}"
|
||||
mode: 0660
|
34
roles/git/templates/gitconfig.j2
Normal file
34
roles/git/templates/gitconfig.j2
Normal file
@ -0,0 +1,34 @@
|
||||
# This is Git's per-user configuration file.
|
||||
[user]
|
||||
# Please adapt and uncomment the following lines:
|
||||
name = {{ git_user }}
|
||||
email = {{ git_email }}
|
||||
{% if git_do_sign %}
|
||||
signkey = {{ git_signkey }}
|
||||
signingkey = {{ git_signingkey }}
|
||||
{% endif %}
|
||||
|
||||
{% if git_do_sign %}
|
||||
[gpg]
|
||||
program = {{ git_gpg_program }}
|
||||
|
||||
{% endif %}
|
||||
[commit]
|
||||
|
||||
{% if git_do_sign %}
|
||||
gpgsign = true
|
||||
{% endif %}
|
||||
|
||||
|
||||
[alias]
|
||||
{% for alias in git_aliases %}
|
||||
{{ alias.name }} = {{ alias.cmd }}
|
||||
{% endfor %}
|
||||
|
||||
{% for cred in git_credentials %}
|
||||
[credential "{{ cred.remote_url }}"]
|
||||
username = {{ cred.username }}
|
||||
{% if cred.helper is defined %}
|
||||
helper = {{ cred.helper }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
Reference in New Issue
Block a user