Install garamond

main
Micke Nordin 1 year ago
parent eb06ad2a6f
commit f73383c4a6

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

Loading…
Cancel
Save