Fix WSL checks on non-WSL distro

This commit is contained in:
Anthony Rose 2023-01-17 21:56:36 +00:00
parent 11ed9a9b00
commit 483326c231

View file

@ -19,16 +19,27 @@
path: /run/ostree-booted path: /run/ostree-booted
register: check_ostree register: check_ostree
- name: Check for WSL - name: Check for WSL
ansible.builtin.command: ansible.builtin.shell: 'grep microsoft /proc/version || /bin/true'
cmd: 'grep microsoft /proc/version'
changed_when: false changed_when: false
ignore_errors: true
register: check_wsl register: check_wsl
- name: Register useful variables - name: Register ostree fact
ansible.builtin.set_fact: ansible.builtin.set_fact:
ostree: check_ostree.exists ostree: check_ostree.exists
wsl: not check_wsl.failed - name: Default wsl fact
ansible.builtin.set_fact:
wsl: false
- name: Register wsl fact
ansible.builtin.set_fact:
wsl: true
when: '"microsoft" in check_wsl.stdout'
- name: Debug WSL - check_wsl
ansible.builtin.debug:
var: check_wsl
- name: Debug WSL - wsl
ansible.builtin.debug:
var: wsl
- include_role: - include_role:
name: arch name: arch