Add wsl role to when WSL is detected in kernel name

This role sets up the non-standard `win_git:` module for use when
managing a Windows host from within WSL on the same system.
This commit is contained in:
Kenneth Benzie 2022-05-01 19:41:56 +01:00
parent cce6dd88af
commit a3b51a9261
3 changed files with 24 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
external

View File

@ -6,6 +6,8 @@
- role: neovim
- role: git
- role: python
- role: wsl
when: '"WSL" in ansible_kernel'
- hosts: windows
roles:

21
roles/wsl/tasks/main.yaml Normal file
View File

@ -0,0 +1,21 @@
---
- name: create external directory
file:
dest: external
state: directory
- name: clone ansible win_git module
git:
repo: https://github.com/tivrobo/ansible-win_git.git
dest: external/ansible-win_git
version: master
- name: create ansible modules directory
file:
dest: ~/.ansible/plugins/modules
state: directory
- name: copy win_git files to ansible modules directory
copy:
src: '~/.config/local/external/ansible-win_git/{{item}}'
dest: '~/.ansible/plugins/modules/{{item}}'
with_items:
- win_git.ps1
- win_git.py