---

- name: Install ZSH with Aptitude
  become: true
  apt: pkg=zsh state=latest update_cache=yes cache_valid_time={{ aptcachetime }}

- name: Gather default shell facts
  shell: 'echo $SHELL'
  register: default_shell
  changed_when: false

- name: Make ZSH default shell
  shell: chsh -s /bin/zsh
  when: default_shell.stdout.find('/bin/zsh') == -1

---

- name: Install ZSH with Aptitude
  become: true
  apt: pkg=zsh state=latest update_cache=yes cache_valid_time={{ aptcachetime }}

- name: Gather default shell facts
  shell: 'echo $SHELL'
  register: default_shell
  changed_when: false

- name: Make ZSH default shell
  shell: chsh -s /bin/zsh
  when: default_shell.stdout.find('/bin/zsh') == -1

- name: Gather default shell facts (for root)
  shell: 'echo $SHELL'
  register: default_root_shell
  changed_when: false
  become: true

- name: Make ZSH default shell (for root)
  shell: chsh root -s /bin/zsh
  when: default_root_shell.stdout.find('/bin/zsh') == -1
  become: true

Update ZSH role to also update root shell
Update ZSH role to also update root shell
