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