From a8cf690c3126d279aa2853dd0fd5900bf07b23d9 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 23 Jan 2023 14:13:14 +0000 Subject: [PATCH] Fix GUI run on WSL --- roles/home-cli/tasks/main.yml | 20 ++++++++++++++++++++ roles/home-gui/tasks/main.yml | 1 + user-cli.yml | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/roles/home-cli/tasks/main.yml b/roles/home-cli/tasks/main.yml index 3f67c62..a87c37f 100644 --- a/roles/home-cli/tasks/main.yml +++ b/roles/home-cli/tasks/main.yml @@ -13,6 +13,26 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Check if an ostree OS (e.g. Silverblue) + ansible.builtin.stat: + path: /run/ostree-booted + register: check_ostree +- name: Check for WSL + ansible.builtin.shell: 'grep microsoft /proc/version || /bin/true' + changed_when: false + register: check_wsl + +- name: Register ostree fact + ansible.builtin.set_fact: + ostree: check_ostree.exists +- 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' + - import_tasks: shell.yml - import_tasks: dirs.yml diff --git a/roles/home-gui/tasks/main.yml b/roles/home-gui/tasks/main.yml index d97bbc3..e5c6e88 100644 --- a/roles/home-gui/tasks/main.yml +++ b/roles/home-gui/tasks/main.yml @@ -17,6 +17,7 @@ - import_tasks: dotfiles.yml - import_tasks: flatpak.yml + when: wsl == false - import_tasks: firefox.yml - import_tasks: gnome.yml - import_tasks: mate.yml diff --git a/user-cli.yml b/user-cli.yml index 37bfed5..7d97269 100755 --- a/user-cli.yml +++ b/user-cli.yml @@ -14,10 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Setup GUI for user only +- name: Setup CLI for user only hosts: all vars: - gui: true + gui: false tasks: - include_role: name: home-cli