From a3b51a92617ce736d8c8066c8b98fdaa7f95f5bf Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sun, 1 May 2022 19:41:56 +0100 Subject: [PATCH] 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. --- .gitignore | 1 + main.yaml | 2 ++ roles/wsl/tasks/main.yaml | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 .gitignore create mode 100644 roles/wsl/tasks/main.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5446323 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +external diff --git a/main.yaml b/main.yaml index fc65f36..3725874 100644 --- a/main.yaml +++ b/main.yaml @@ -6,6 +6,8 @@ - role: neovim - role: git - role: python + - role: wsl + when: '"WSL" in ansible_kernel' - hosts: windows roles: diff --git a/roles/wsl/tasks/main.yaml b/roles/wsl/tasks/main.yaml new file mode 100644 index 0000000..f761ea5 --- /dev/null +++ b/roles/wsl/tasks/main.yaml @@ -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