Add git role for unix-like OS families and Windows

This commit is contained in:
Kenneth Benzie 2022-04-30 16:58:55 +01:00
parent 66444c69a6
commit d4218aeeee
5 changed files with 49 additions and 0 deletions

View File

@ -4,7 +4,9 @@
- zsh
- tmux
- neovim
- git
- hosts: windows
roles:
- neovim
- git

View File

@ -0,0 +1,9 @@
---
- name: clone config repos
win_git:
repo: '{{item.repo}}'
dest: '{{ansible_env.USERPROFILE}}/.config/{{item.name}}'
version: master
with_items: '{{git_config_repos}}'
# TODO: - name: install pip packages

View File

@ -0,0 +1,5 @@
---
- when: ansible_os_family != "Windows"
include_tasks: 'unix.yaml'
- when: ansible_os_family == "Windows"
include_tasks: 'Windows.yaml'

25
roles/git/tasks/unix.yaml Normal file
View File

@ -0,0 +1,25 @@
---
- name: clone config repos
git:
repo: '{{item.repo}}'
dest: '~/.config/{{item.name}}'
version: master
with_items: '{{git_config_repos}}'
- name: install homebrew packages
when: ansible_os_family == "Darwin"
homebrew:
name: gpg
state: latest
- name: install pip packages
pip:
name: '{{git_pip_packages}}'
extra_args: --user
state: latest
- name: create symbolic links
file:
state: link
src: ~/.config/git/_git-changes
dest: ~/.local/share/zsh/site-functions/_git-changes

8
roles/git/vars/main.yaml Normal file
View File

@ -0,0 +1,8 @@
---
git_config_repos:
- repo: git@code.infektor.net:config/git.git
name: git
- repo: git@code.infektor.net:benie/config.git
name: private
git_pip_packages:
- git+https://github.com/kbenzie/git-issue.git