57 lines
2.0 KiB
YAML
57 lines
2.0 KiB
YAML
---
|
|
- name: "Install common dependencies"
|
|
ansible.builtin.apt:
|
|
name:
|
|
- software-properties-common
|
|
- ca-certificates
|
|
- apt-transport-https
|
|
- unzip
|
|
state: present
|
|
update_cache: yes
|
|
|
|
- name: "Add Ondřej PPA for PHP"
|
|
ansible.builtin.apt_repository:
|
|
repo: "ppa:ondrej/php"
|
|
state: present
|
|
|
|
# ------------------ WSL Configuration for Correct File Permissions ------------------
|
|
# This block automatically detects and configures WSL for a seamless experience.
|
|
|
|
- name: "Check if running in a WSL environment"
|
|
ansible.builtin.stat:
|
|
path: /proc/version
|
|
register: proc_version_stat
|
|
|
|
- name: "Set is_wsl fact based on /proc/version content"
|
|
ansible.builtin.set_fact:
|
|
is_wsl: "'Microsoft' in (lookup('file', '/proc/version') | default(''))"
|
|
when: proc_version_stat.stat.exists
|
|
|
|
- name: "Ensure correct automount options are set in /etc/wsl.conf"
|
|
ansible.builtin.blockinfile:
|
|
path: /etc/wsl.conf
|
|
create: yes
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
marker: "# {mark} ANSIBLE MANAGED BLOCK - LENVI AUTOMOUNT"
|
|
block: |
|
|
[automount]
|
|
enabled = true
|
|
options = "metadata,uid={{ ansible_user_uid }},gid={{ ansible_user_gid }},umask=22,fmask=11"
|
|
[user]
|
|
default = {{ ansible_user_id }}
|
|
register: wsl_conf_result
|
|
when: is_wsl | default(false)
|
|
|
|
- name: Ensure /home/{{ ansible_user_id }} is executable by all (chmod +x)
|
|
ansible.builtin.file:
|
|
path: "/home/{{ ansible_user_id }}"
|
|
mode: '0711'
|
|
|
|
- name: "FOR WSL USER: This error is safe and intentional. Follow instructions below."
|
|
ansible.builtin.fail:
|
|
msg: |
|
|
✅ ACTION REQUIRED: WSL Configuration was Updated! Lenvi has configured /etc/wsl.conf to fix file permissions. You MUST restart WSL for this change to take effect. Please perform the following steps: 1. Close this terminal. 2. Open Windows PowerShell or CMD (not as admin). 3. Run the command: wsl --shutdown 4. Wait a few seconds, then re-open your WSL terminal and cd ~/Lenvi. 5. Re-run ./lenvi.sh
|
|
|
|
when: wsl_conf_result.changed |