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 :
---
- 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 }}"
when:
- stat_config.stat.exists
- pkgconfig[pkg] is defined
ansible.builtin.include_tasks:
file: "config/{{ pkg }}.yml"
- name: "Add include task for {{ pkg }}"
when:
- stat_pkg.stat.exists
ansible.builtin.include_tasks:
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:
alacritty:
deps: "{{ pkgconfig.alacritty[ansible_os_family].build_deps }}"
ver: "{{ pkgconfig.alacritty.version }}"
repo: "{{ pkgconfig.alacritty.git_repo }}"
pkgs: "{{ pkgconfig.alacritty[ansible_os_family].pkgs | default(omit) }}"
bin: "{{ paths.install }}/bin/alacritty"
cargo:
vers: "{{ pkgconfig.alacritty.version }}"
cask: "{{ pkgconfig.alacritty.cask | default(omit) }}"
locked: true
pkg: alacritty
name: alacritty

View File

@@ -1,3 +1,7 @@
# 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:
method: "{{ pkgconfig.libreoffice.method }}"
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
- Monoid
- NerdFontsSymbolsOnly
install_path: "{{ path_prefix }}/{{ pkgconfig.nerdfonts.path }}"
install_path: "{{ path.prefix }}/{{ pkgconfig.nerdfonts.path }}"
base_url: "{{ pkgconfig.nerdfonts.base_url }}"
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:
- ansible_os_family == 'RedHat'
block:
- name: Set distro name
ansible.builtin.set_fact:
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
ansible.builtin.set_fact:
zfs:

View File

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

View File

@@ -3,7 +3,8 @@
- name: Set facts for installation
ansible.builtin.set_fact:
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
when:
@@ -18,6 +19,14 @@
pkg_snap: [] # snpacraft.io packages
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
when:
- ansible_distribution == 'MacOSX'
@@ -30,13 +39,14 @@
- name: Set paths
ansible.builtin.set_fact:
paths:
appimage: "{{ appimage_path | default(path_prefix ~ defaults.path.suffix.appimage) }}"
archive: "{{ archive_path | default(path_prefix ~ defaults.path.suffix.archive) }}"
bin: "{{ bin_path | default(path_prefix ~ defaults.path.suffix.bin) }}"
cargo: "{{ cargo_path | default(path_prefix ~ defaults.path.suffix.cargo) }}"
go: "{{ goroot | default(path_prefix ~ defaults.path.suffix.go) }}"
pipx: "{{ pipx_path | default(path_prefix ~ defaults.path.suffix.pipx) }}"
path:
prefix: "{{ path.prefix }}"
appimage: "{{ path.appimage | default(path.prefix ~ defaults.path.suffix.appimage) }}"
archive: "{{ path.archive | default(path.prefix ~ defaults.path.suffix.archive) }}"
bin: "{{ path.bin | default(path.prefix ~ defaults.path.suffix.bin) }}"
cargo: "{{ path.cargo | default(path.prefix ~ defaults.path.suffix.cargo) }}"
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
ansible.builtin.set_fact:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,23 +1,11 @@
# 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
ansible.builtin.set_fact:
srcpkgs: "{{ srcpkgs + ['lua-language-server'] }}"
- name: Append to syspkgs
- name: Append to pkg_sys
when:
- ansible_os_family == 'Darwin'
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 :
---
- name: Set hashicorp flag
ansible.builtin.set_fact:
hashicorp: true
- name: RedHat repository
when:
- 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:
version: 0.15.0
version: 0.15.1
RedHat:
pkgs: []
build_deps:
- cmake
- freetype-devel
@@ -10,7 +9,6 @@ alacritty:
- libxkbcommon-devel
- g++
Debian:
pkgs: []
build_deps:
- cmake
- pkg-config
@@ -19,7 +17,5 @@ alacritty:
- libxcb-xfixes0-dev
- libxkbcommon-dev
- python3
Darwin:
pkgs:
cask:
- alacritty
git_repo: https://github.com/alacritty/alacritty.git

View File

@@ -1,6 +1,16 @@
carapace:
version: 0.2.0
pkgs:
Linux:
- carapace-bin
Darwin:
- 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:
Linux: consul
Darwin: hashicorp/tap/consul
pkgs:
Linux:
- consul
Darwin:
- hashicorp/tap/consul

View File

@@ -1,8 +1,8 @@
hashicorp:
Linux:
RedHat:
".el9":
repo: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
Fedora:
fedora:
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"

View File

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