summaryrefslogtreecommitdiffstats
path: root/roles/font/tasks/main.yml
blob: 119e222f18f6bce68eb060402914ee37884383f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- name: "Include OS-specific variables"
  ansible.builtin.include_vars: "{{ ansible_facts['os_family'] | lower }}.yml"

- name: "Ensure fontconfig is installed"
  become: true
  ansible.builtin.package:
    name: "fontconfig"
    state: "present"

- name: "Ensure fonts are installed"
  become: true
  ansible.builtin.package:
    name: "{{ item }}"
    state: "present"
  loop: "{{ font_packages }}"

- name: "Ensure fontconfig global directory exists"
  become: true
  ansible.builtin.file:
    path: "{{ item }}"
    state: "directory"
    mode: "0755"
  loop:
    - "/etc/fonts"
    - "/etc/fonts/conf.d"

- name: "Add global font configurations"
  become: true
  ansible.builtin.template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: "0644"
  loop:
    - src: "local.conf.j2"
      dest: "/etc/fonts/local.conf"
  notify:
    - "Update font-cache"

- name: "Configure fonts presets"
  become: true
  ansible.builtin.file:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    state: "link"
  loop: "{{ font_presets }}"

- name: "Install Nerd Fonts"
  when: "font_nerd_fonts | default([]) | length > 0"
  ansible.builtin.include_tasks: "install-nerd-fonts.yml"

- name: "Install Google Fonts"
  when: "font_google_font_families | default([]) | length > 0"
  ansible.builtin.include_tasks: "install-google-fonts.yml"