From f1bec95c3e053e5a1fa158d4df9b682562e5bf3a Mon Sep 17 00:00:00 2001 From: Nicola Belluti Date: Fri, 10 Oct 2025 16:01:40 +0200 Subject: [PATCH] Added distro and become password verification, Set fish shell as the default shell --- setup-script/playbook.yaml | 13 ++++++++++++- setup-script/roles/shell/tasks/main.yaml | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/setup-script/playbook.yaml b/setup-script/playbook.yaml index ce91ef1..effebcd 100644 --- a/setup-script/playbook.yaml +++ b/setup-script/playbook.yaml @@ -4,13 +4,24 @@ gather_facts: false pre_tasks: - - name: 'Ensure the "chezmoi" variable is set' + - name: Ensure the "chezmoi" variable is set ansible.builtin.assert: that: - chezmoi is not undefined - chezmoi is mapping fail_msg: 'Pass with: --extra-vars "$(chezmoi data --format=json)"' + - name: Verify the become password is correct + become: true + ansible.builtin.command: + cmd: "true" + changed_when: false + + - name: Verify the distro + ansible.builtin.debug: + msg: "The setup script for now supports only Arch Linux!" + when: chezmoi.osRelease.id != "arch" + roles: - role: shell when: features.shell == true diff --git a/setup-script/roles/shell/tasks/main.yaml b/setup-script/roles/shell/tasks/main.yaml index 632f181..de9fcf8 100644 --- a/setup-script/roles/shell/tasks/main.yaml +++ b/setup-script/roles/shell/tasks/main.yaml @@ -3,3 +3,14 @@ ansible.builtin.pacman: name: fish when: chezmoi.osRelease.id == "arch" + +- name: Find Fish shell binary + command: which fish + register: fish_path + changed_when: false + failed_when: fish_path.rc != 0 + +- name: Set the user's shell + ansible.builtin.user: + name: "{{ chezmoi.username }}" + shell: "{{ fish_path.stdout }}"