Install garamond

main
Micke Nordin 1 year ago
parent eb06ad2a6f
commit f73383c4a6

@ -2,38 +2,60 @@
- name: Set up fonts
vars:
uid: "{{ lookup('env','USER') }}"
font_name: UbuntuMono
font_path: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/{{ font_name }}.zip
fonts:
- key: UbuntuMono
value: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/UbuntuMono.zip
- key: EBGaramond
value: https://www.fontsc.com/font/download/eb-garamond
font_size: 14
hosts: localhost
connection: local
become: false
tasks:
- name: Have font installed allready
stat:
path: /usr/local/share/fonts/{{ font_name }}
register: font
- name: Make font dir
ansible.builtin.file:
dest: /tmp/{{ font_name }}
state: directory
when: not font.stat.exists
ansible.builtin.stat:
path: /usr/local/share/fonts/{{ item.key }}
register: r
loop: '{{ fonts }}'
- name: get font
ansible.builtin.command:
chdir: /tmp/{{ font_name }}
cmd: wget {{ font_path }}
when: not font.stat.exists
- name: unizip font
chdir: /tmp/
cmd: wget -O {{ item.item.key }}.zip {{ item.item.value }}
when: not item.stat.exists
loop: '{{ r.results }}'
- name: create font dir
ansible.builtin.file:
dest: /tmp/{{ item.item.key }}
state: directory
when: not item.stat.exists
loop: '{{ r.results }}'
- name: unzip font
become: true
ansible.builtin.command:
chdir: /tmp/{{ font_name }}
cmd: unzip {{ font_name }}.zip
when: not font.stat.exists
chdir: /tmp/{{ item.item.key }}
cmd: unzip ../{{ item.item.key }}.zip
when: not item.stat.exists
loop: '{{ r.results }}'
- name: install font
become: true
ansible.builtin.command:
chdir: /tmp/
cmd: mv {{ font_name }} /usr/local/share/fonts/
when: not font.stat.exists
cmd: mv {{ item.item.key }} /usr/local/share/fonts/
creates: /usr/local/share/fonts/{{ item.item.key }}
when: not item.stat.exists
loop: '{{ r.results }}'
- name: delete font dir
ansible.builtin.file:
dest: /tmp/{{ item.item.key }}
state: absent
when: not item.stat.exists
loop: '{{ r.results }}'
- name: delete font zip
ansible.builtin.file:
dest: /tmp/{{ item.item.key }}.zip
state: absent
when: not item.stat.exists
loop: '{{ r.results }}'
- name: make foot dir
ansible.builtin.file:
dest: /home/{{ uid }}/.config/foot

Loading…
Cancel
Save