diff --git a/playbook.yml b/playbook.yml index 6b2775d..2f99cf1 100644 --- a/playbook.yml +++ b/playbook.yml @@ -24,6 +24,11 @@ ansible.builtin.import_tasks: 'tasks/systemd.yml' tags: systemd + # TODO: move to development playbook + - name: Git provisioning + ansible.builtin.import_tasks: 'tasks/git.yml' + tags: git + - name: Systemd timer provisioning ansible.builtin.import_tasks: 'tasks/timer.yml' tags: timers diff --git a/tasks/git.yml b/tasks/git.yml new file mode 100644 index 0000000..63185b2 --- /dev/null +++ b/tasks/git.yml @@ -0,0 +1,30 @@ +- name: Copy git configuration + ansible.builtin.template: + src: 'templates/gitconfig.j2' + dest: '{{ ansible_env.HOME }}/.gitconfig' + mode: '0755' + +- name: Copy keys + ansible.builtin.copy: + src: '{{ item.src }}' + dest: '{{ item.dest }}' + mode: '0755' + loop: + - src: 'files/personal/all/gpg/gpg_key' + dest: '{{ ansible_env.HOME }}/gpg.key' + - src: 'files/personal/all/gpg/gpg_pub' + dest: '{{ ansible_env.HOME }}/gpg.pub' + +- name: Import secret key + ansible.builtin.command: 'gpg --passphrase {{ gpg_passphrase }} --import ~/gpg.key' + +- name: Import public key + ansible.builtin.command: 'gpg --import ~/gpg.pub' + +- name: Remove temp keys + ansible.builtin.file: + path: '{{ item }}' + state: absent + loop: + - '{{ ansible_env.HOME }}/gpg.key' + - '{{ ansible_env.HOME }}/gpg.pub' diff --git a/templates/gitconfig.j2 b/templates/gitconfig.j2 new file mode 100644 index 0000000..91ae366 --- /dev/null +++ b/templates/gitconfig.j2 @@ -0,0 +1,28 @@ +# {{ ansible_managed }} +# +[user] +email = sonny871@hotmail.com +name = Sonny Bakker +signingkey = {{ gpg_pub_key }} + +[core] +editor = nvim +pager = delta + +[interactive] +diffFilter = delta --color-only + +[pull] +rebase = false + +[merge] +tool = nvimdiff +conflictstyle = diff3 + +[diff] +colorMoved = default + +[delta] +navigate = true +hyperlinks = true +line-numbers = true