Compare commits
3 Commits
a5aacce6df
...
682307c35d
Author | SHA1 | Date | |
---|---|---|---|
682307c35d | |||
27f05a1a34 | |||
669a97adcb |
15
roles/git/defaults/main.yml
Normal file
15
roles/git/defaults/main.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
git_config_file: ~/.gitconfig
|
||||
|
||||
git_config_gpg_program: gpg2
|
||||
git_config_commit_gpgsign: false
|
||||
git_config_pull_rebase: true
|
||||
git_config_pull_ff: only
|
||||
git_config_rebase_autostash: true
|
||||
git_config_merge_autostash: true
|
||||
git_config_init_default_branch: main
|
||||
git_config_core_editor: vim
|
||||
|
||||
git_config_user: []
|
||||
git_config_credentials: []
|
45
roles/git/tasks/main.yml
Normal file
45
roles/git/tasks/main.yml
Normal file
@ -0,0 +1,45 @@
|
||||
---
|
||||
|
||||
- name: Ensure git configuration is persisted in git configs file
|
||||
blockinfile:
|
||||
dest: "{{ git_config_file }}"
|
||||
mode: "0660"
|
||||
create: yes
|
||||
state: present
|
||||
marker: "#{mark} ANSIBLE MANAGED BLOCK by finallycoffee.base.git"
|
||||
block: |+2
|
||||
{% if git_config_user_name|default(false, true) and git_config_user_email|default(false, true) %}
|
||||
[user]
|
||||
name = {{ git_config_user_name }}
|
||||
email = {{ git_config_user_email }}
|
||||
{% if git_config_user_signingkey %}
|
||||
signingkey = {{ git_config_user_signingkey }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
[gpg]
|
||||
program = {{ git_config_gpg_program }}
|
||||
[core]
|
||||
editor = {{ git_config_core_editor }}
|
||||
[commit]
|
||||
gpgsign = {{ git_config_commit_gpgsign }}
|
||||
[pull]
|
||||
rebase = {{ git_config_pull_rebase }}
|
||||
ff = {{ git_config_pull_ff }}
|
||||
[rebase]
|
||||
autostash = {{ git_config_rebase_autostash }}
|
||||
[merge]
|
||||
autostash = {{ git_config_merge_autostash }}
|
||||
[init]
|
||||
defaultBranch = {{ git_config_init_default_branch }}
|
||||
[alias]
|
||||
{% for alias in git_config_alias %}
|
||||
{{ alias.name }} = {{ alias.command }}
|
||||
{% endfor %}
|
||||
|
||||
{% for credentialset in git_config_credentials %}
|
||||
[credential "{{ credentialset.remote_url }}"]
|
||||
{% for entry in credentialset.config | dict2items %}
|
||||
{{ entry.key }} = {{ entry.value }}
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
@ -11,3 +11,4 @@ fi
|
||||
|
||||
gpg-connect-agent /bye
|
||||
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||
gpgconf --launch gpg-agent
|
||||
|
@ -10,6 +10,9 @@ personal-digest-preferences SHA256 SHA512 SHA384 SHA224
|
||||
{% if gpg_config_ignore_time_conflict %}
|
||||
ignore-time-conflict
|
||||
{% endif %}
|
||||
{% if gpg_config_trusted_key %}
|
||||
trusted-key {{ gpg_config_trusted_key }}
|
||||
{% endif %}
|
||||
|
||||
# How to render keys
|
||||
keyid-format {{ gpg_config_keyid_format }}
|
||||
|
Loading…
Reference in New Issue
Block a user