79816080

Date: 2025-11-10 21:57:02
Score: 2
Natty:
Report link

Despite the fact @insideClaw answer is the best practice, I want show how you can achieve that by modify the "/etc/passwd" file; which contain the shell of all users.

    - name: Change the default shell to ZSH 
      ansible.builtin.shell: | 
        OLD_LINE_PASSWD=$(grep "$USER" /etc/passwd)
        NEW_LINE_PASSWD=$(echo $OLD_LINE_PASSWD | sed "s|$SHELL|/usr/bin/zsh|")
        sudo sed -i "s|$OLD_LINE_PASSWD|$NEW_LINE_PASSWD|" /etc/passwd
      become_user: "{{ ansible_user }}"
Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Has code block (-0.5):
  • User mentioned (1): @insideClaw
  • Low reputation (0.5):
Posted by: Ninja-Flex6969