Files
infra/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml
2026-07-28 15:07:37 +02:00

65 lines
1.9 KiB
YAML

---
- name: Ensure WSL tmux directories exist
tags: [dotfiles, dotfiles:workstation, tmux, wsl]
ansible.builtin.file:
path: "{{ user_home }}/{{ item }}"
state: directory
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0755"
loop:
- .tmux
- .tmux/bin
- .tmux/plugins
- name: Copy workstation WSL dotfiles
tags: [dotfiles, dotfiles:workstation, wsl]
ansible.builtin.copy:
src: "{{ playbook_dir }}/../dotfiles/{{ item.source_dir | default('workstation_dev_wsl') }}/{{ item.src }}"
dest: "{{ user_home }}/{{ item.dest }}"
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "{{ item.mode }}"
loop: "{{ workstation_dev_wsl_dotfiles | default([]) }}"
loop_control:
label: "{{ item.dest }}"
- name: Ensure WSL boot configuration file exists
tags: [packages, services]
ansible.builtin.file:
path: /etc/wsl.conf
state: touch
owner: root
group: root
mode: "0644"
when: workstation_wsl_systemd_enabled | default(false)
- name: Enable systemd in WSL
tags: [packages, services]
community.general.ini_file:
path: /etc/wsl.conf
section: boot
option: systemd
value: 'true'
mode: "0644"
register: workstation_wsl_systemd_config
when: workstation_wsl_systemd_enabled | default(false)
- name: Install WSL Python packages for Windows remoting
tags: [packages]
ansible.builtin.pip:
name: "{{ workstation_dev_wsl_python_packages | default([]) }}"
executable: pip3
extra_args: --break-system-packages
state: present
when: (workstation_dev_wsl_python_packages | default([])) | length > 0
- name: Note when WSL must be restarted
tags: [packages, services]
ansible.builtin.debug:
msg: "Restart the WSL distro with 'wsl --shutdown' from Windows to apply /etc/wsl.conf changes."
changed_when: false
when:
- workstation_wsl_systemd_enabled | default(false)
- workstation_wsl_systemd_config is changed