Add hosts template for wsl role

For setting up an ssh connection to the Windows host to manage it.
This commit is contained in:
Kenneth Benzie 2022-06-06 21:28:48 +01:00
parent d172e171b2
commit 1184062dc7
2 changed files with 30 additions and 0 deletions

View File

@ -1,17 +1,38 @@
--- ---
- name: install apt packages
become: true
apt:
name: sshpass
state: latest
- name: create /etc/ansible
become: true
file:
dest: /etc/ansible
state: directory
- name: create hosts file
become: true
template:
src: templates/hosts.j2
dest: /etc/ansible/hosts
- name: create external directory - name: create external directory
file: file:
dest: external dest: external
state: directory state: directory
- name: clone ansible win_git module - name: clone ansible win_git module
git: git:
repo: https://github.com/tivrobo/ansible-win_git.git repo: https://github.com/tivrobo/ansible-win_git.git
dest: external/ansible-win_git dest: external/ansible-win_git
version: master version: master
- name: create ansible modules directory - name: create ansible modules directory
file: file:
dest: ~/.ansible/plugins/modules dest: ~/.ansible/plugins/modules
state: directory state: directory
- name: copy win_git files to ansible modules directory - name: copy win_git files to ansible modules directory
copy: copy:
src: '~/.config/local/external/ansible-win_git/{{item}}' src: '~/.config/local/external/ansible-win_git/{{item}}'

View File

@ -0,0 +1,9 @@
---
all:
children:
windows:
hosts:
{{ansible_hostname}}.local:
ansible_user: {{ansible_user_id}}
ansible_connection: ssh
ansible_shell_type: cmd