Add git configuration
This commit is contained in:
parent
2d5e5caa25
commit
7f3dd527af
3 changed files with 83 additions and 36 deletions
|
|
@ -2,3 +2,6 @@ dotfiles_repo: 'git@forgejo.fudiggity.nl:sonny/dotfiles.git'
|
|||
|
||||
git_domain: 'forgejo.fudiggity.nl'
|
||||
git_host_key: 'forgejo.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBqEej87ukSK7KGi7e0q+oTrru4h7Fm6fK8GgiMtu01+'
|
||||
|
||||
git_name: Sonny Bakker
|
||||
git_email: sonny871@hotmail.com
|
||||
|
|
|
|||
|
|
@ -1,25 +1,15 @@
|
|||
- name: clone dotfiles
|
||||
git:
|
||||
- name: Clone dotfiles
|
||||
ansible.builtin.git:
|
||||
repo: '{{ dotfiles_repo }}'
|
||||
dest: '{{ ansible_env.HOME }}/dotfiles'
|
||||
version: master
|
||||
update: yes
|
||||
register: dotfile_ssh_clone
|
||||
ignore_errors: true
|
||||
|
||||
- name: clone dotfiles
|
||||
git:
|
||||
repo: '{{ public_dotfiles_repo }}'
|
||||
dest: '{{ ansible_env.HOME }}/dotfiles'
|
||||
version: master
|
||||
update: yes
|
||||
when: dotfile_ssh_clone.failed
|
||||
update: true
|
||||
|
||||
- name: Create xdg configuration directories
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
state: directory
|
||||
mode: '744'
|
||||
mode: '0755'
|
||||
loop:
|
||||
- '{{ xdg_config_dir }}/git'
|
||||
- '{{ xdg_config_dir }}/tmux'
|
||||
|
|
@ -30,31 +20,32 @@
|
|||
state: absent
|
||||
loop:
|
||||
- '{{ ansible_env.HOME }}/.tmux.conf'
|
||||
- '{{ ansible_env.HOME }}/.gitconfig'
|
||||
|
||||
- name: setup dotfiles
|
||||
file:
|
||||
- name: Setup dotfiles
|
||||
ansible.builtin.file:
|
||||
path: '{{ item.dest }}'
|
||||
src: '{{ item.src }}'
|
||||
state: link
|
||||
force: true
|
||||
loop:
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/.vimrc',
|
||||
dest: '{{ ansible_env.HOME }}/.vimrc',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/.bashrc',
|
||||
dest: '{{ ansible_env.HOME }}/.bashrc',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/.profile',
|
||||
dest: '{{ ansible_env.HOME }}/.profile',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/.tmux.conf',
|
||||
dest: '{{ xdg_config_dir }}/tmux/tmux.conf',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/.gitignore',
|
||||
dest: '{{ xdg_config_dir }}/git/ignore',
|
||||
}
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.vimrc'
|
||||
dest: '{{ ansible_env.HOME }}/.vimrc'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.bashrc'
|
||||
dest: '{{ ansible_env.HOME }}/.bashrc'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.profile'
|
||||
dest: '{{ ansible_env.HOME }}/.profile'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.tmux.conf'
|
||||
dest: '{{ xdg_config_dir }}/tmux/tmux.conf'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.gitignore'
|
||||
dest: '{{ xdg_config_dir }}/git/ignore'
|
||||
|
||||
- name: Copy git configuration
|
||||
ansible.builtin.template:
|
||||
src: 'templates/gitconfig.j2'
|
||||
dest: '{{ xdg_config_dir }}/git/config'
|
||||
mode: '0755'
|
||||
|
|
|
|||
53
templates/gitconfig.j2
Normal file
53
templates/gitconfig.j2
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[user]
|
||||
email = {{ git_email }}
|
||||
name = {{ git_name }}
|
||||
|
||||
[core]
|
||||
editor = nvim
|
||||
{% if ansible_facts['os_family'] == 'Archlinux' %}
|
||||
pager = delta
|
||||
{% endif %}
|
||||
|
||||
{% if ansible_facts['os_family'] == 'Archlinux' %}
|
||||
[interactive]
|
||||
diffFilter = delta --color-only
|
||||
{% endif %}
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[commit]
|
||||
verbose = true
|
||||
|
||||
[push]
|
||||
default = simple
|
||||
autoSetupRemote = true
|
||||
|
||||
[pull]
|
||||
rebase = false
|
||||
|
||||
[fetch]
|
||||
prune = true
|
||||
pruneTags = true
|
||||
all = true
|
||||
|
||||
[merge]
|
||||
tool = nvimdiff
|
||||
conflictstyle = zdiff3
|
||||
|
||||
[diff]
|
||||
colorMoved = default
|
||||
mnemonicPrefix = true
|
||||
renames = true
|
||||
|
||||
[help]
|
||||
autocorrect = prompt
|
||||
|
||||
{% if ansible_facts['os_family'] == 'Archlinux' %}
|
||||
[delta]
|
||||
navigate = true
|
||||
hyperlinks = true
|
||||
line-numbers = true
|
||||
{% endif %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue