more fixs for packages

This commit is contained in:
Matthew Stobbs
2025-02-20 15:03:54 -07:00
parent c0400949c3
commit 41b1acc067
34 changed files with 181 additions and 201 deletions

View File

@@ -1,31 +1,11 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: "Check if task exists for {{ pkg }}"
ansible.builtin.stat:
path: "{{ role_path }}/tasks/pkgs/{{ pkg }}.yml"
register: stat_pkg
- name: Dump stat_pkg
ansible.builtin.debug:
var: stat_pkg
- name: "Check if specialized configuration exists for {{ pkg }}"
ansible.builtin.stat:
path: "{{ role_path }}/tasks/config/{{ pkg }}.yml"
register: stat_config
- name: Dump stat_config
ansible.builtin.debug:
var: stat_config
- name: "Load specialized configuration if it exists for {{ pkg }}" - name: "Load specialized configuration if it exists for {{ pkg }}"
when: when:
- stat_config.stat.exists - pkgconfig[pkg] is defined
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: "config/{{ pkg }}.yml" file: "config/{{ pkg }}.yml"
- name: "Add include task for {{ pkg }}" - name: "Add include task for {{ pkg }}"
when:
- stat_pkg.stat.exists
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: "pkgs/{{ pkg }}.yml" file: "pkgs/{{ pkg }}.yml"

36
tasks/archive/luals.yml Normal file
View File

@@ -0,0 +1,36 @@
# vim: set filetype=yaml.ansible :
---
- name: Create temp path
register: d_luals_dl_tmp
ansible.builtin.tempfile:
state: directory
prefix: luals_dl.
- name: Get latest lua-language-server
become: "{{ ext_become }}"
ansible.builtin.get_url:
dest: "{{ d_luals_dl_tmp.path }}/{{ luals_vars.archive }}"
url: "{{ luals_vars.url }}/{{ luals_vars.archive }}"
mode: "0644"
decompress: false
- name: Create install_path
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
path: "{{ path.archive }}/luals"
mode: "0755"
- name: Extract lua language server archive
become: "{{ ext_become }}"
ansible.builtin.unarchive:
dest: "{{ path.archive }}/luals"
src: "{{ d_luals_dl_tmp.path }}/{{ luals_vars.archive }}"
remote_src: true
- name: Link lua language server binary
become: "{{ ext_become }}"
ansible.builtin.file:
state: link
src: "{{ path.bin }}/lua-language-server"
path: "{{ path.archive }}/luals/bin/lua-language-server"

View File

@@ -4,10 +4,7 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
alacritty: alacritty:
deps: "{{ pkgconfig.alacritty[ansible_os_family].build_deps }}" deps: "{{ pkgconfig.alacritty[ansible_os_family].build_deps }}"
ver: "{{ pkgconfig.alacritty.version }}" vers: "{{ pkgconfig.alacritty.version }}"
repo: "{{ pkgconfig.alacritty.git_repo }}" cask: "{{ pkgconfig.alacritty.cask | default(omit) }}"
pkgs: "{{ pkgconfig.alacritty[ansible_os_family].pkgs | default(omit) }}"
bin: "{{ paths.install }}/bin/alacritty"
cargo:
locked: true locked: true
pkg: alacritty name: alacritty

View File

@@ -1,3 +1,7 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
version: 1.1.1 - name: Set carapace config
ansible.builtin.set_fact:
carapace:
pkgs: "{{ pkgconfig.carapace.pkgs[ansible_system] }}"
repo: "{{ pkgconfig.carapace.repo[ansible_os_family] }}"

4
tasks/config/clangd.yml Normal file
View File

@@ -0,0 +1,4 @@
- name: Set clangd config
ansible.builtin.set_fact:
clangd:
pkgs: "{{ pkgconfig.clangd.pkg[ansible_os_family] }}"

4
tasks/config/consul.yml Normal file
View File

@@ -0,0 +1,4 @@
- name: Set configuration for consul
ansible.builtin.set_fact:
consul:
pkgs: "{{ pkgconfig.consul.pkgs[ansible_system] }}"

View File

@@ -0,0 +1,13 @@
- name: Set OS name for RedHat family
when:
- ansible_os_famly == 'RedHat'
ansible.builtin.set_fact:
hashicorp:
repo: "{{ pkgconfig.hashicorp.Linux[rpm_dist.stdout] }}"
- name: Set repo for debian
when:
- ansible_os_family == 'Debian'
ansible.builtin.set_Fact:
hashicorp:
repo: "{{ pkgconfig.hashicorp.Linux.Debian }}"

4
tasks/config/kitty.yml Normal file
View File

@@ -0,0 +1,4 @@
- name: Set kitty config
ansible.buitlin.set_fact:
kitty:
pkgs: "{{ pkgconfig.kitty.pkgs[ansible_system] }}"

View File

@@ -5,4 +5,4 @@
libreoffice: libreoffice:
method: "{{ pkgconfig.libreoffice.method }}" method: "{{ pkgconfig.libreoffice.method }}"
flatpak: "{{ pkgconfig.libreoffice.flatpak }}" flatpak: "{{ pkgconfig.libreoffice.flatpak }}"
syspkgs: "{{ pkgconfig.libreoffice[ansible_os_family] }}" pkgs: "{{ pkgconfig.libreoffice[ansible_os_family] }}"

View File

@@ -1,5 +0,0 @@
# vim: set filetype=yaml.ansible :
---
version: 3.13.5
install_prefix: "{{ default_install_prefix }}"
install_path: /opt/lua-language-server

14
tasks/config/luals.yml Normal file
View File

@@ -0,0 +1,14 @@
# vim: set filetype=yaml.ansible :
---
- name: Set luals config
ansible.builtin.set_fact:
luals:
vers: "{{ pkgconfig.luals.version }}"
sys: "{{ pkgconfig.luals.sysmap[ansible_system] }}"
arch: "{{ pkgconfig.luals.archmap[ansible_architecture] }}"
- name: Set luals variables
ansible.builtin.set_fact:
luals_vars:
archive: "lua-language-server-{{ luals.vers }}-{{ luals.sys }}-{{ luals.arch }}.tar.gz"
url: "{{ pkgconfig.luals.base_url }}/{{ luals.vers }}"

View File

@@ -10,6 +10,6 @@
- Lilex - Lilex
- Monoid - Monoid
- NerdFontsSymbolsOnly - NerdFontsSymbolsOnly
install_path: "{{ path_prefix }}/{{ pkgconfig.nerdfonts.path }}" install_path: "{{ path.prefix }}/{{ pkgconfig.nerdfonts.path }}"
base_url: "{{ pkgconfig.nerdfonts.base_url }}" base_url: "{{ pkgconfig.nerdfonts.base_url }}"
force_install: "{{ pkgconfig.force_install_nerdfonts | default(false) }}" force_install: "{{ pkgconfig.force_install_nerdfonts | default(false) }}"

View File

@@ -1,18 +1,10 @@
--- ---
- name: Set zfs facts for RedHat based distros - name: Set distro name
when: when:
- ansible_os_family == 'RedHat' - ansible_os_family == 'RedHat'
block:
- name: Set distro name
ansible.builtin.set_fact: ansible.builtin.set_fact:
rhname: "{%if ansible_distribution == 'Fedora' %}fedora{% else %}epel{% endif %}" rhname: "{%if ansible_distribution == 'Fedora' %}fedora{% else %}epel{% endif %}"
- name: Get rpm_dist for RedHat
changed_when: false
register: rpm_dist
ansible.builtin.command: # is there a better way to get this?
cmd: rpm --eval "%{dist}"
- name: Set ZFS config - name: Set ZFS config
ansible.builtin.set_fact: ansible.builtin.set_fact:
zfs: zfs:

View File

@@ -4,5 +4,5 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
zig: zig:
version: 0.13.0 version: 0.13.0
install_prefix: "{{ default_install_prefix }}" install_prefix: "{{ path.prefix }}"
install_path: /opt/zig install_path: "{{ path.archive }}/zig"

View File

@@ -3,7 +3,8 @@
- name: Set facts for installation - name: Set facts for installation
ansible.builtin.set_fact: ansible.builtin.set_fact:
ext_become: "{{ not use_local }}" ext_become: "{{ not use_local }}"
path_prefix: "{% if use_local %}{{ lookup('ansible.builtin.env', 'HOME') }}/.local{% else %}{{ defaults.path.prefix }}{% endif %}" path:
prefix: "{% if use_local %}{{ lookup('ansible.builtin.env', 'HOME') }}/.local{% else %}{{ defaults.path.prefix }}{% endif %}"
- name: Set Linux specific facts - name: Set Linux specific facts
when: when:
@@ -18,6 +19,14 @@
pkg_snap: [] # snpacraft.io packages pkg_snap: [] # snpacraft.io packages
sys_pkg_become: true # Linux package managers require sudo access sys_pkg_become: true # Linux package managers require sudo access
- name: Set rpm dist if RedHat based
when:
- ansible_os_family == 'RedHat'
changed_when: false
register: rpm_dist
ansible.builtin.command:
cmd: rpm --eval "%{dist}"
- name: Set macOS specific facts - name: Set macOS specific facts
when: when:
- ansible_distribution == 'MacOSX' - ansible_distribution == 'MacOSX'
@@ -30,13 +39,14 @@
- name: Set paths - name: Set paths
ansible.builtin.set_fact: ansible.builtin.set_fact:
paths: path:
appimage: "{{ appimage_path | default(path_prefix ~ defaults.path.suffix.appimage) }}" prefix: "{{ path.prefix }}"
archive: "{{ archive_path | default(path_prefix ~ defaults.path.suffix.archive) }}" appimage: "{{ path.appimage | default(path.prefix ~ defaults.path.suffix.appimage) }}"
bin: "{{ bin_path | default(path_prefix ~ defaults.path.suffix.bin) }}" archive: "{{ path.archive | default(path.prefix ~ defaults.path.suffix.archive) }}"
cargo: "{{ cargo_path | default(path_prefix ~ defaults.path.suffix.cargo) }}" bin: "{{ path.bin | default(path.prefix ~ defaults.path.suffix.bin) }}"
go: "{{ goroot | default(path_prefix ~ defaults.path.suffix.go) }}" cargo: "{{ path.cargo | default(path.prefix ~ defaults.path.suffix.cargo) }}"
pipx: "{{ pipx_path | default(path_prefix ~ defaults.path.suffix.pipx) }}" go: "{{ path.go | default(path.prefix ~ defaults.path.suffix.go) }}"
pipx: "{{ path.pipx | default(path.prefix ~ defaults.path.suffix.pipx) }}"
- name: Set OS independant facts - name: Set OS independant facts
ansible.builtin.set_fact: ansible.builtin.set_fact:

View File

@@ -6,15 +6,15 @@
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: facts.yml file: facts.yml
- name: Ensure required paths exist - name: Ensure required path exist
become: "{{ ext_become }}" become: "{{ ext_become }}"
loop: "{{ paths | dict2items }}" loop: "{{ path | dict2items }}"
loop_control: loop_control:
loop_var: path loop_var: p
ansible.builtin.file: ansible.builtin.file:
state: directory state: directory
mode: '0755' mode: '0755'
path: "{{ path.value }}" path: "{{ p.value }}"
- name: Read default package configuration - name: Read default package configuration
ansible.builtin.include_vars: ansible.builtin.include_vars:

View File

@@ -1,16 +1,18 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Linux based installation - name: Linux based installation
when: ansible_system == 'Linux' when:
- ansible_system == 'Linux'
block: block:
- name: Append to pkgs - name: Append to pkgs
notify: notify:
- Depend cargo - Depend cargo
ansible.builtin.set_fact: ansible.builtin.set_fact:
syspkgs: "{{ syspkgs + alacritty.deps }}" pkg_sys: "{{ pkg_sys + alacritty.deps }}"
srcpkgs: "{{ cargopkgs + [alacritty] }}" pkg_cargo: "{{ pkg_cargo + [alacritty] }}"
- name: Append alacritty to caskpkgs - name: Append alacritty to caskpkgs
when:
- ansible_system == 'Darwin'
ansible.builtin.set_fact: ansible.builtin.set_fact:
caskpkgs: "{{ caskpkgs + alacritty.pkgs }}" caskpkgs: "{{ caskpkgs + alacritty.cask }}"
when: ansible_system == 'Darwin'

View File

@@ -1,31 +1,27 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- ansible.builtin.include_vars: - name: Enable carapace yum repository
file: carapace.yml when:
name: _carapace - ansible_os_family == 'RedHat'
- ansible.builtin.set_fact: become: true
pkgconfig_carapace: "{{ _carapace | ansible.builtin.combine(pkgconfig.carapace) }}"
- name: enable carapace yum repository
ansible.builtin.yum_repository: ansible.builtin.yum_repository:
name: carapace-yum name: "{{ carapace.repo.name }}"
description: carapace-yum description: "{{ carapace.repo.description }}"
baseurl: https://yum.fury.io/rsteube/ baseurl: "{{ charapace.repo.baseurl }}"
enabled: true enabled: true
gpgcheck: false gpgcheck: false
state: present state: present
when: ansible_os_family == 'RedHat'
become: true
- name: enable carapace apt repository - name: Enable carapace apt repository
when:
- ansible_os_family == 'Debian'
become: true become: true
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
repo: "deb [trusted=yes] https://apt.fury.io/rsteube/ /" repo: "{{ carapace.repo.repo }}"
filename: "{{ carapace.repo.name }}"
state: present state: present
update_cache: false update_cache: false
filename: carapace
when: ansible_os_family == 'Debian'
- name: add carapace to syspkgs - name: Add carapace to pkg_sys
ansible.builtin.set_fact: ansible.builtin.set_fact:
syspkgs: "{{ syspkgs + pkgconfig_carapace.pkgs[ansible_system] }}" pkg_sys: "{{ pkg_sys + carapace.pkgs }}"

View File

@@ -1,7 +1,5 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- ansible.builtin.set_fact: - name: Append clangd to pkg_sys
clangd: true ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + clangd.pkgs }}"
- ansible.builtin.set_fact:
syspkgs: "{{ syspkgs + pkgconfig.clangd.pkgs[ansible_os_family] }}"

View File

@@ -1,16 +1,13 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
# load hashicorp configuration
--- ---
- name: ensure hashicorp repo is active - name: Append to pkg_sys
ansible.builtin.include_tasks: when:
file: "pkgs/hashicorp_repo.yml" - ansible_system == 'Linux'
when: hashicorp is undefined
- name: append to syspkgs
ansible.builtin.set_fact: ansible.builtin.set_fact:
syspkgs: "{{ syspkgs + [ pkgconfig.consul[ansible_system] ] }}" pkg_sys: "{{ pkg_sys + consul.pkgs }}"
when: ansible_system == 'Linux'
- ansible.builtin.set_fact: - name: Append to pkg_tap
tappkgs: "{{ tappkgs + [ pkgconfig.consul[ansible_system] ] }}" when:
when: ansible_system == 'Darwin' - ansible_system == 'Darwin'
ansible.builtin.set_fact:
pkg_tap: "{{ pkg_tap + consul.pkgs }}"

3
tasks/pkgs/hashicorp.yml Normal file
View File

@@ -0,0 +1,3 @@
- name: Enable hashicorp repository
ansible.builtin.include_tasks:
file: repos/hashicorp.yml

View File

@@ -1,5 +1,5 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: add to syspkgs - name: Add to pkg_sys
ansible.builtin.set_fact: ansible.builtin.set_fact:
syspkgs: "{{ syspkgs + pkgconfig.kitty.pkgs[ansible_system] }}" pkg_sys: "{{ pkg_sys + kitty.pkgs }}"

View File

@@ -14,7 +14,7 @@
when: when:
- libreoffice.method == 'sys' - libreoffice.method == 'sys'
ansible.builtin.set_fact: ansible.builtin.set_fact:
sys_pkg: "{{ sys_pkg + libreoffice.syspkgs }}" sys_pkg: "{{ sys_pkg + libreoffice.pkgs }}"
- name: Append to caskpkgs - name: Append to caskpkgs
when: when:

View File

@@ -1,23 +1,11 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Linux specific configuration
when:
- ansible_os_family != 'Darwin'
block:
- name: Load lua-language-server config
ansible.builtin.include_vars:
file: lua-language-server.yml
name: _luals
- name: Combine loaded config with defaults
ansible.builtin.set_fact:
pkgconfig_luals: "{{ _luals | ansible.builtin.combine(pkgconfig.luals) }}"
- name: Append to pkgs - name: Append to pkgs
ansible.builtin.set_fact: ansible.builtin.set_fact:
srcpkgs: "{{ srcpkgs + ['lua-language-server'] }}" srcpkgs: "{{ srcpkgs + ['lua-language-server'] }}"
- name: Append to syspkgs - name: Append to pkg_sys
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
ansible.builtin.set_fact: ansible.builtin.set_fact:
syspkgs: "{{ syspkgs + ['lua-language-server'] }}" pkg_sys: "{{ pkg_sys + ['lua-language-server'] }}"

View File

@@ -1,9 +1,5 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Set hashicorp flag
ansible.builtin.set_fact:
hashicorp: true
- name: RedHat repository - name: RedHat repository
when: when:
- ansible_os_family == 'RedHat' - ansible_os_family == 'RedHat'

View File

@@ -1,7 +0,0 @@
# vim: set filetype=yaml.ansible :
---
- name: Build and install alacritty
become: "{{ not use_local }}"
ansible.builtin.command:
creates: "{{ alacritty.bin }}"
cmd: "cargo install --root {{ paths.cargo }} alacritty@{{ alacritty.ver }}"

View File

@@ -1,56 +0,0 @@
# vim: set filetype=yaml.ansible :
---
- name: Set needed variables lua language server
ansible.builtin.set_fact:
luals_sys: pkgconfig_luals.sysmap[ansible_system]
luals_arch: pkgconfig_luals.archmap[ansible_architecture]
luals_ver: pkgconfig_luals.version
luals_instpath: pkgconfig_luals.install_path
luals_instpfx: pkgconfig_luals.install_prefix
luals_burl: pkgconfig_luals.base_url
- name: Set luals archive name
ansible.builtin.set_fact:
luals_pkg: "lua-language-server-{{ luals_ver }}-{{ lualsl_sys }}-{{ luals_arch }}.tar.gz"
- name: Check if lua language server is already installed
ansible.builtin.stat:
path: "{{ luals_instpath }}/bin/lua-language-server"
register: r_luals_stat
- name: Install lua-language-server
when: not r_luals_stat.stat.exists
block:
- name: Create temp path
ansible.builtin.tempfile:
state: directory
prefix: luals_dl.
register: d_luals_dl_tmp
- name: Get latest lua-language-server
ansible.builtin.get_url:
dest: "{{ d_luals_dl_tmp.path }}/{{ luals_pkg }}"
url: "{{ luals_burl }}/{{ luals_ver }}/{{ luals_pkg }}"
mode: "0644"
decompress: false
- name: Create install_path
ansible.builtin.file:
state: directory
path: "{{ luals_instpath }}"
mode: "0755"
become: true
- name: Extract lua language server archive
ansible.builtin.unarchive:
dest: "{{ luals_instpath }}"
src: "{{ d_luals_dl_tmp.path }}/{{ luals_pkg }}"
remote_src: true
become: true
- name: Link lua language server binary
ansible.builtin.file:
state: link
src: "{{ luals_instpath }}/bin/lua-language-server"
path: "{{ luals_instpfx }}/bin/lua-language-server"
become: true

View File

@@ -1,7 +1,6 @@
alacritty: alacritty:
version: 0.15.0 version: 0.15.1
RedHat: RedHat:
pkgs: []
build_deps: build_deps:
- cmake - cmake
- freetype-devel - freetype-devel
@@ -10,7 +9,6 @@ alacritty:
- libxkbcommon-devel - libxkbcommon-devel
- g++ - g++
Debian: Debian:
pkgs: []
build_deps: build_deps:
- cmake - cmake
- pkg-config - pkg-config
@@ -19,7 +17,5 @@ alacritty:
- libxcb-xfixes0-dev - libxcb-xfixes0-dev
- libxkbcommon-dev - libxkbcommon-dev
- python3 - python3
Darwin: cask:
pkgs:
- alacritty - alacritty
git_repo: https://github.com/alacritty/alacritty.git

View File

@@ -1,6 +1,16 @@
carapace: carapace:
version: 0.2.0
pkgs: pkgs:
Linux: Linux:
- carapace-bin - carapace-bin
Darwin: Darwin:
- carapace - carapace
repo:
RedHat:
name: carapace-yum
description: carapace-yum
baseurl: https://yum.fury.io/rsteube/
Debian:
repo: "deb [trusted=yes] https://apt.fury.io/rsteube/ /"
name: carapace
Darwin: {}

View File

@@ -1,3 +1,6 @@
consul: consul:
Linux: consul pkgs:
Darwin: hashicorp/tap/consul Linux:
- consul
Darwin:
- hashicorp/tap/consul

View File

@@ -1,8 +1,8 @@
hashicorp: hashicorp:
Linux: Linux:
RedHat: ".el9":
repo: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo repo: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
Fedora: fedora:
repo: https://rpm.releases.hashicorp.com/fedora/hashicorp.repo repo: https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
Debian: debian:
repo: "deb [arch={{ ansible_architecture }} signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main" repo: "deb [arch={{ ansible_architecture }} signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main"

View File

@@ -1,4 +1,5 @@
luals: luals:
version: 3.13.5
base_url: https://github.com/LuaLS/lua-language-server/releases/download base_url: https://github.com/LuaLS/lua-language-server/releases/download
sysmap: sysmap:
Darwin: darwin Darwin: darwin