56 lines
1.3 KiB
YAML
56 lines
1.3 KiB
YAML
---
|
|
- name: Include vault variables
|
|
ansible.builtin.include_vars: vault.yml
|
|
|
|
- name: Install git (Archlinux)
|
|
become: true
|
|
community.general.pacman:
|
|
name:
|
|
- git
|
|
when: ansible_facts['distribution'] == 'Archlinux'
|
|
|
|
- name: Install git (Debian)
|
|
become: true
|
|
ansible.builtin.apt:
|
|
name:
|
|
- git
|
|
when: ansible_facts['distribution'] == 'Debian'
|
|
|
|
- name: Create git config directory
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: 0755
|
|
with_items:
|
|
- ~/.config
|
|
- ~/.config/git
|
|
|
|
- name: Copy global gitignore
|
|
ansible.builtin.copy:
|
|
src: ignore
|
|
dest: ~/.config/git/ignore
|
|
mode: 0644
|
|
|
|
- name: Check values for git_username
|
|
community.general.git_config:
|
|
scope: global
|
|
name: user.name
|
|
register: git_username
|
|
|
|
- name: Check values for git_useremail
|
|
community.general.git_config:
|
|
scope: global
|
|
name: user.email
|
|
register: git_useremail
|
|
|
|
- name: Set vars for global gitconfig
|
|
ansible.builtin.set_fact:
|
|
username: "{{ (git_username.config_value != '') | ternary(git_username.config_value, username_if_absent) }}"
|
|
useremail: "{{ (git_useremail.config_value != '') | ternary(git_useremail.config_value, git_email) }}"
|
|
|
|
- name: Copy global gitconfig
|
|
ansible.builtin.template:
|
|
src: gitconfig.j2
|
|
dest: ~/.gitconfig
|
|
backup: true
|
|
mode: 0644
|