1
0

Added distro and become password verification, Set fish shell as the default shell

This commit is contained in:
2025-10-10 16:01:40 +02:00
parent f59e5dafab
commit f1bec95c3e
2 changed files with 23 additions and 1 deletions

View File

@@ -4,13 +4,24 @@
gather_facts: false gather_facts: false
pre_tasks: pre_tasks:
- name: 'Ensure the "chezmoi" variable is set' - name: Ensure the "chezmoi" variable is set
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- chezmoi is not undefined - chezmoi is not undefined
- chezmoi is mapping - chezmoi is mapping
fail_msg: 'Pass with: --extra-vars "$(chezmoi data --format=json)"' 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: roles:
- role: shell - role: shell
when: features.shell == true when: features.shell == true

View File

@@ -3,3 +3,14 @@
ansible.builtin.pacman: ansible.builtin.pacman:
name: fish name: fish
when: chezmoi.osRelease.id == "arch" 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 }}"