55 lines
1.1 KiB
YAML
55 lines
1.1 KiB
YAML
---
|
|
- name: create wsl.conf
|
|
become: true
|
|
template:
|
|
src: templates/wsl.conf.j2
|
|
dest: /etc/wsl.conf
|
|
|
|
- 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 binfmt_misc config file
|
|
become: true
|
|
template:
|
|
src: templates/binfmt_misc.j2
|
|
dest: /usr/lib/binfmt.d/WSLInterop.conf
|
|
notify: restart systemd-binfmt
|
|
|
|
- name: create external directory
|
|
file:
|
|
dest: external
|
|
state: directory
|
|
|
|
- name: read /etc/resolv.conf file contents
|
|
set_fact:
|
|
resolv_conf: '{{lookup("ansible.builtin.file", "/etc/resolv.conf")}}'
|
|
|
|
- name: get Windows host IP from /etc/resolv.conf
|
|
set_fact:
|
|
host_ip: '{{resolv_conf | regex_search("(\d+\.\d+\.\d+\.\d+)")}}'
|
|
|
|
- name: add $(hostname).local to /etc/hosts
|
|
become: true
|
|
lineinfile:
|
|
path: /etc/hosts
|
|
regexp: '^{{host_ip | replace(".", "\.")}}'
|
|
line: '{{host_ip}} {{ansible_hostname}}.local'
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|