working on nerdfonts still

This commit is contained in:
Matthew Stobbs
2026-02-10 16:13:44 -07:00
parent 906603b6d4
commit 2c1f4ec422
6 changed files with 74 additions and 88 deletions

View File

@@ -2,20 +2,33 @@
---
- name: Set package_home_base for Darwin
when:
- ansible_system == 'Darwin'
- ansible_facts["system"] == 'Darwin'
ansible.builtin.set_fact:
package_home_base: /Users
- name: Set package_home_base for Linux
when:
- ansible_system == 'Linux' or
ansible_os_family == 'FreeBSD'
- ansible_facts["system"] == 'Linux' or
ansible_facts["os_family"] == 'FreeBSD'
ansible.builtin.set_fact:
package_home_base: /home
- name: Set default paths
ansible.builtin.set_fact:
path_appimage: "{{ install_prefix }}/appimage"
path_archive: "{{ install_prefix }}/archive"
path_bin: "{{ install_prefix }}/bin"
path_cargo: "{{ install_prefix }}/cargo"
path_git: "{{ install_prefix }}/git"
path_go: "{{ install_prefix }}/go"
path_pipx: "{{ install_prefix }}/pipx"
store_path: "{{ ansible_facts['user_dir'] }}/.cache/ansible_role_package"
path_lib: "{{ install_prefix }}/lib"
- name: Set Linux specific facts
when:
- ansible_system == 'Linux'
- ansible_facts["system"] == 'Linux'
ansible.builtin.set_fact:
pipx_exec: "/usr/bin/pipx"
path_lib: lib64
@@ -23,13 +36,13 @@
- name: Set alpine linux specific facts
when:
- ansible_os_family == 'Alpine'
- ansible_facts["os_family"] == 'Alpine'
ansible.builtin.set_fact:
path_lib: lib
- name: Set dist code if RedHat based
when:
- ansible_os_family == 'RedHat'
- ansible_facts["os_family"] == 'RedHat'
changed_when: false
register: rpm_dist
ansible.builtin.command:
@@ -37,8 +50,8 @@
- name: Set macOS specific facts
when:
- ansible_distribution == 'MacOSX' or
ansible_distribution == 'MacOS'
- ansible_facts["distribution"] == 'MacOSX' or
ansible_facts["distribution"] == 'MacOS'
ansible.builtin.set_fact:
brewtap: [] # homebrew taps to add
pipx_exec: "/opt/homebrew/bin/pipx" # pipx executable

View File

@@ -6,6 +6,9 @@
- archive.name is defined
- archive.url is defined
block:
- name: Dump archive vars
ansible.builtin.debug:
var: archive
- name: Extract archive to given path
block:
- name: Ensure directory exists
@@ -15,8 +18,8 @@
state: directory
path: "{{ archive.extract_to }}"
mode: "{{ archive.mode | default('0755') }}"
owner: "{{ archive.owner | default(ansible_user_id)}}"
group: "{{ archive.group | default(ansible_user_gid) }}"
owner: "{{ archive.owner | default(ansible_facts['user_id']) }}"
group: "{{ archive.group | default(ansible_facts['user_gid']) }}"
- name: Download archive to cache
ansible.builtin.get_url:

View File

@@ -0,0 +1,27 @@
# vim: set filetype=yaml.ansible :
---
- name: Load nerdfonts list
ansible.builtin.include_vars:
file: nerdfonts.yml
name: __nerdfonts
- name: Generate nerdfont configs
when:
- __nerdfonts[nf] is defined
ansible.builtin.set_fact:
__font_config:
extract_to: "{{ path_archive }}/nerdfonts/{{ nf }}"
url: "{{ nerdfonts_base_url }}/{{ __nerdfonts[nf]['archive'] | default(nf) }}.tar.xz"
name: "{{ __nerdfonts[nf]['archive'] | default(nf) }}.tar.xz"
links:
- from: "{{ path_archive }}/nerdfonts/{{ nf }}"
to: "{{ install_prefix }}/{{ nerdfonts_install_path }}/{{ nf }}"
force: true
- name: Dump current nerdfont config
ansible.builtin.debug:
var: __font_config
- name: Append config to pkg archive
ansible.builtin.set_fact:
pkg_archive: "{{ pkg_archive + [__font_config] }}"

View File

@@ -13,8 +13,8 @@
ansible.builtin.file:
path: "{{ store_path }}"
mode: '0755'
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
owner: "{{ ansible_facts['user_id'] }}"
group: "{{ ansible_facts['user_gid'] }}"
state: directory
- name: Ensure required paths exists
@@ -40,16 +40,21 @@
- name: Read package configuration
ansible.builtin.include_vars:
file: pkglist.yml
- name: Load nerdfonts list
ansible.builtin.include_vars:
file: nerdfonts.yml
name: __nerdfonts
- name: Add needed packages for Fedora
when:
- ansible_distribution == 'Fedora'
- ansible_facts["distribution"] == 'Fedora'
ansible.builtin.set_fact:
pkg_sys: "{{ packages_extra + ['python3-paramiko'] }}"
- name: Add needed MacOS packages
when:
- ansible_distribution == 'MacOSX'
- ansible_facts["distribution"] == 'MacOSX'
ansible.builtin.set_fact:
pkg_sys: "{{ packages_extra + ['gnu-tar', 'virtualenv'] }}"
@@ -159,13 +164,13 @@
- name: Linux specific tasks
when:
- ansible_system == 'Linux'
- ansible_facts["system"] == 'Linux'
ansible.builtin.include_tasks:
file: linux.yml
- name: MacOS specific tasks
when:
- ansible_distribution == 'MacOSX'
- ansible_facts["distribution"] == 'MacOSX'
ansible.builtin.include_tasks:
file: macos.yml

View File

@@ -2,7 +2,7 @@
---
- name: Add nerdfonts
when:
- "'nerdfonts' in __configured"
- "'nerdfonts' not in __configured"
block:
- name: Load nerdfonts list
ansible.builtin.include_vars:
@@ -12,46 +12,30 @@
- name: Create nerdfonts directories
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
when:
- nerdfonts_install_list|length > 0
loop: "{{ nerdfonts_install_list }}"
loop_control:
loop_var: nf
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ install_prefix }}/{{ nerdfonts_install_path }}/{{ nf }}"
path: "{{ install_prefix }}/{{ nerdfonts_install_path }}"
owner: "{{ install_prefix_owner }}"
group: "{{ install_prefix_group }}"
- name: Generate nerdfont configs
- name: Configure nerdfonts archive install
when:
- nerdfonts_install_list|length > 0
- ansible_facts["system"] != 'Darwin'
loop: "{{ nerdfonts_install_list }}"
loop_control:
loop_var: nf
ansible.bulitin.set_fact:
"nerdfont_{{ nf }}":
extract_to: "{{ install_prefix }}/{{ nerdfonts_install_path }}/{{ nf }}"
url: "{{ nerdfonts_base_url }}/{{ __nerdfonts[nf].archive | default(nf) }}.tar.xz"
- name: Create nerdfont install list
when:
- nerdfonts_install_list|length > 0
loop: "{{ nerdfonts_install_list }}"
loop_control:
loop_var: nf
ansible.builtin.set_fact:
nerdfonts_archives: "{{ nerdfonts_archives + [] }}"
ansible.builtin.include_tasks: helpers/nerdfont_config.yml
- name: Append nerdfonts to pkg_cask
when:
- ansible_system == 'Darwin'
loop: "{{ nerdfonts.fonts }}"
- ansible_facts["system"] == 'Darwin'
loop: "{{ nerdfonts_install_list }}"
loop_control:
loop_var: font
loop_var: nf
ansible.builtin.set_fact:
pkg_cask: "{{ pkg_cask + [pkgconfig.nerdfonts.fonts[font].brew] }}"
pkg_cask: "{{ pkg_cask + [__nerdfonts[nf].brew] }}"
- name: Set nerdfonts_configured
ansible.builtin.set_fact: