# Install nerdfonts for each platform --- - name: linux installation when: ansible_system == 'Linux' block: - name: set install path for non-system installs ansible.builtin.set_fact: nerdfonts_install_path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.local/share/fonts" when: not _nerdfonts.nerdfonts_system_install - name: set install path for system wide installs ansible.builtin.set_fact: nerdfonts_install_path: "/usr/local/share/fonts" when: _nerdfonts.nerdfonts_system_install - name: create nerdfonts directories ansible.builtin.file: path: "{{ nerdfonts_install_path }}/{{ font.name }}" state: directory become: "{{ _nerdfonts.nerdfonts_system_install }}" loop: "{{ nerdfonts }}" loop_control: loop_var: font register: nerdfont_result - name: Download and extract nerdfonts ansible.builtin.unarchive: creates: "{{ nerdfonts_install_path }}/{{ font.name }}/README.md" src: "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/{{ font.name }}.tar.xz" dest: "{{ nerdfonts_install_path }}/{{ font.name }}" remote_src: true when: nerdfont_result is changed become: nerdfonts_system_install loop: "{{ _nerdfonts.fonts }}" loop_control: loop_var: font