--- - name: '[home] get user account information' ansible.builtin.getent: database: passwd key: "{{ common_user_account }}" split: ":" changed_when: false when: ansible_facts['getent_passwd'] is undefined or common_user_account not in ansible_facts['getent_passwd'] - name: '[shell] install ZSH and dependencies' become: true ansible.builtin.apt: update_cache: true force_apt_get: true cache_valid_time: 3600 pkg: - git - zsh state: present - name: '[shell] install custom fonts' become: true become_user: "{{ common_user_account }}" block: - name: '[fonts] add fonts tooling' become_user: root ansible.builtin.apt: update_cache: true force_apt_get: true cache_valid_time: 3600 pkg: - fontconfig - name: '[fonts] adding fonts' ansible.builtin.copy: src: ../assets/fonts/ dest: "{{ ansible_facts['getent_passwd'][common_user_account][4] }}/.local/share/fonts" mode: '0640' - name: '[fonts] refresh fonts cache' ansible.builtin.command: cmd: fc-cache changed_when: false when: common_install_fonts is truthy - name: '[shell] install Oh-My-ZSH' become: true become_user: "{{ common_user_account }}" block: - name: '[omz] get install script' ansible.builtin.get_url: url: https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh dest: /tmp/zsh-install.sh mode: '0750' - name: '[omz] install OMZ' ansible.builtin.command: cmd: sh /tmp/zsh-install.sh --unattended creates: "{{ ansible_facts['getent_passwd'][common_user_account][4] }}/.oh-my-zsh" - name: '[shell] install powerlevel10k customization for OMZ' become: true become_user: "{{ common_user_account }}" ansible.builtin.git: repo: https://github.com/romkatv/powerlevel10k.git dest: "{{ ansible_facts['getent_passwd'][common_user_account][4] }}/.oh-my-zsh/custom/themes/powerlevel10k" depth: 1 - name: '[home] copy zsh files' become: true become_user: "{{ common_user_account }}" ansible.builtin.copy: src: "../templates/home/{{ item }}" dest: "{{ ansible_facts['getent_passwd'][common_user_account][4] }}/{{ item }}" mode: '0640' loop: - .p10k.zsh - .zsh_aliases - .zsh_completions - .zsh_exports - .zsh_functions - .zshrc - name: '[shell] update user shell to ZSH' become: true ansible.builtin.user: name: "{{ common_user_account }}" shell: "/usr/bin/zsh" state: present