fix packages

This commit is contained in:
Matthew Stobbs
2025-02-22 14:59:18 -07:00
parent 2d825d855d
commit d1e8957f94
47 changed files with 166 additions and 129 deletions

View File

@@ -1,7 +1,7 @@
# vim: set filetype=yaml.ansible :
---
- name: Install appimage
become: "{{ archive_become }}"
become: "{{ ext_become }}"
block:
- name: Ensure appimage path exists
ansible.builtin.file:
@@ -10,7 +10,7 @@
state: directory
- name: Fetch appimage
become: "{{ archive_become }}"
become: "{{ ext_become }}"
ansible.builtin.get_url:
mode: '0755'
decompress: false
@@ -19,7 +19,7 @@
dest: "{{ path.appimage }}/{{ pkg.link_name }}/{{ pkg.file }}"
- name: Link appimage to bin
become: "{{ archive_become }}"
become: "{{ ext_become }}"
ansible.builtin.file:
state: link
src: "{{ path.appimage }}/{{ pkg.link_name }}/{{ pkg.file }}"

View File

@@ -20,8 +20,8 @@
become: "{{ sys_pkg_become }}"
register: get_url_go
ansible.builtin.get_url:
dest: "{{ path.cache }}/{{ go.archive }}"
url: "{{ go.url }}"
dest: "{{ d_tempdir.path }}/{{ go.archive }}"
url: "{{ go.base_url }}/{{ go.archive }}"
checksum: "{{ go.sum }}"
decompress: false
mode: '0644'
@@ -32,7 +32,7 @@
- ansible_system == 'Linux'
ansible.builtin.unarchive:
dest: "{{ path.prefix }}"
src: "{{ d_go_dl_tmp.path }}/{{ go.archive }}"
src: "{{ d_tempdir.path }}/{{ go.archive }}"
remote_src: true
- name: Install go macOS using pkg file
@@ -40,5 +40,4 @@
when:
- ansible_distribution == 'MacOSX'
ansible.builtin.command:
creates: "{{ path.go }}"
cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go.archive }} -target /"
cmd: "installer -pkg {{ d_tempdir.path }}/{{ go.archive }} -target /"

View File

@@ -2,41 +2,31 @@
---
- name: Download zls archive
ansible.builtin.set_fact:
zls_path: "zls-{{ pkgconfig_zls.sysmap[ansible_system] }}-{{ pkgconfig_zls.archmap[ansible_architecture] }}-{{ pkgconfig_zls.version }}"
zls_pkg: "zls-{{ pkgconfig_zls.sysmap[ansible_system] }}-{{ pkgconfig_zls.archmap[ansible_architecture] }}-{{ pkgconfig_zls.version }}.tar.xz"
- name: Check if zls exists
ansible.builtin.stat:
path: "{{ pkgconfig_zls.install_path }}/{{ zls_path }}/zls"
path: "{{ path.archive }}/{{ zls_path }}/zls"
register: r_zls_stat
- name: Update/install zls
when:
- not r_zls_stat.stat.exists
block:
- name: Create temp path
ansible.builtin.tempfile:
state: directory
prefix: zls_dl.
register: d_zls_dl_tmp
- name: Download zls archive
ansible.builtin.get_url:
dest: "{{ d_zls_dl_tmp.path }}/{{ zls_pkg }}"
url: "{{ pkgconfig.zls.base_url }}/{{ zls_pkg }}"
dest: "{{ d_tempfile.path }}/{{ zls_pkg }}"
url: "{{ zls.base_url }}/{{ zls_pkg }}"
decompress: false
mode: '0644'
- name: Extract zls package
become: "{{ ext_become }}"
ansible.builtin.unarchive:
dest: "{{ path.ardhive }}/{{ zls_path }}"
src: "{{ d_zls_dl_tmp.path }}/{{ zls_pkg }}"
dest: "{{ path.archive }}"
src: "{{ d_tempfile.path }}/{{ zls_pkg }}"
remote_src: true
- name: Link zls binary
become: "{{ ext_become }}"
ansible.builtin.file:
state: link
src: "{{ path.ardhive }}/{{ zls_path }}/zls"
src: "{{ path.archive }}/{{ zls_path }}/zls"
path: "{{ path.bin }}/zls"

View File

@@ -1,7 +1,7 @@
# vim: set filetype=yaml.ansible
---
- name: Install cargo pkg
become: "{{ archive_become }}"
become: "{{ ext_become }}"
community.general.cargo:
name: "{{ pkg.name }}"
version: "{{ pkg.vers }}"

View File

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

View File

@@ -1,4 +1,4 @@
- name: Set fd config
ansible.builtin.set_fact:
fd:
pkgs: "{{ pkgconfig.fd.pkgs[ansible_os_famly] }}"
pkgs: "{{ pkgconfig.fd.pkgs[ansible_system] }}"

View File

@@ -3,7 +3,8 @@
- name: Set go configuration
ansible.builtin.set_fact:
go:
arch: "{{ pkgconfig_go.archmap[ansible_architecture] }}"
method: archive
arch: "{{ pkgconfig.go.archmap[ansible_architecture] }}"
ext: "{{ pkgconfig.go.extmap[ansible_system] }}"
sys: "{{ ansible_system | lower }}"
vers: "{{ pkgconfig.go.version }}"
@@ -11,11 +12,12 @@
- name: Set go composite facts
ansible.builtin.set_fact:
go:
method: archive
arch: "{{ go.arch }}"
archive: "go{{ go.ver }}.{{ go.sys }}-{{ go.arch }}.{{ pkgconfig_go.extmap[ansible_system] }}"
archive: "go{{ go.vers }}.{{ go.sys }}-{{ go.arch }}.{{ pkgconfig.go.extmap[ansible_system] }}"
ext: "{{ go.ext }}"
inst_path: "{{ path.install }}/go"
inst_path: "{{ path.prefix }}"
sum: "{{ pkgconfig.go.sums[go.vers][ansible_system][go.arch] }}"
sys: "{{ go.sys }}"
url: "{{ pkgconfig.go.base_url }}/{{ go.archive }}"
base_url: "{{ pkgconfig.go.base_url }}"
vers: "{{ go.vers }}"

View File

@@ -3,6 +3,6 @@
- name: Set libreoffice config
ansible.builtin.set_fact:
libreoffice:
method: "{{ pkgconfig.libreoffice.method }}"
method: "{{ pkgconfig.libreoffice.methods[ansible_distribution] | default(pkgconfig.libreoffice.methods.default) }}"
flatpak: "{{ pkgconfig.libreoffice.flatpak }}"
pkgs: "{{ pkgconfig.libreoffice[ansible_os_family] }}"
pkgs: "{{ pkgconfig.libreoffice.pkgs[ansible_os_family] }}"

View File

@@ -3,7 +3,7 @@
- name: Set neovim install method
ansible.builtin.set_fact:
neovim:
method: "{{ pkgconfig.neovim.method[ansible_distribution] | default(pkgconfig.neovim.method.default) }}"
method: "{{ pkgconfig.neovim.methods[ansible_distribution] | default(pkgconfig.neovim.methods.default) }}"
- name: Set neovim config
ansible.builtin.set_fact:

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

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

6
tasks/config/pgadmin.yml Normal file
View File

@@ -0,0 +1,6 @@
- name: Set pgadmin config
ansible.builtin.set_fact:
pgadmin:
method: "{{ pkgconfig.pgadmin.methods[ansible_distribution] | default(pkgconfig.pgadmin.methods.default) }}"
pkgs: "{{ pkgconfig.pgadmin.pkgs[ansible_system] }}"
flatpak: "{{ pkgconfig.pgadmin.flatpak }}"

View File

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

View File

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

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

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

View File

@@ -1,5 +1,9 @@
# vim: set filetype=yaml.ansible :
---
version: 0.13.0
install_prefix: "{{ default_install_prefix }}"
install_path: /opt/zls
- name: Set zls config
ansible.builtin.set_fact:
zls:
path: "zls-{{ pkgconfig.zls.sysmap[ansible_system] }}-{{ pkgconfig.zls.archmap[ansible_architecture] }}-{{ pkgconfig.zls.version }}"
pkg: "zls-{{ pkgconfig.zls.sysmap[ansible_system] }}-{{ pkgconfig.zls.archmap[ansible_architecture] }}-{{ pkgconfig.zls.version }}.tar.xz"
vers: "{{ pkgconfig.zls.version }}"
base_url: "{{ pkgconfig.zls.base_url }}"

View File

@@ -1,6 +1,6 @@
---
- name: Install go packages
become: "{{ archive_become }}"
become: "{{ ext_become }}"
environment:
GOBIN: "{{ path.bin }}"
PATH: "{{ path.go }}/bin:$PATH"

View File

@@ -3,13 +3,13 @@
- name: Install flatpaks on Linux Systems
when:
- flatpaks|length > 0
- pkg_flatpak|length > 0
block:
- name: Add flatpak remotes
when:
- flatpak_remotes|length > 0
- flatpak_remote|length > 0
become: "{{ ext_become }}"
loop: "{{ flatpak_remotes | unique }}"
loop: "{{ flatpak_remote | unique }}"
loop_control:
loop_var: remote
community.general.flatpak_remote:
@@ -20,8 +20,10 @@
state: present
- name: Install flatpaks
when:
- pkg_flatpak|length > 0
become: "{{ ext_become }}"
loop: "{{ flatpaks | unique }}"
loop: "{{ pkg_flatpak | unique }}"
loop_control:
loop_var: flatpak
community.general.flatpak:

View File

@@ -1,19 +1,22 @@
# vim: set filetype=yaml.ansible :
---
- name: Tap homebrew taps
when:
- brewtap|length > 0
community.general.homebrew_tap:
name: "{{ brew_taps | unique }}"
name: "{{ brewtap | unique }}"
state: present
when: brew_taps|length > 0
- name: Install homebrew casks
when: pkg_cask|length > 0
community.general.homebrew_cask:
name: "{{ cask_pkgs | unique }}"
name: "{{ pkg_cask | unique }}"
state: present
when: cask_pkgs|length > 0
# TODO: fix the need to have this workaround
- name: Workaround to install homebrew taps
ansible.builtin.command:
cmd: "brew install {{ (tap_pkgs | unique) | join(' ') }}"
when:
- pkg_tap|length > 0
changed_when: true
ansible.builtin.command:
cmd: "brew install {{ (pkg_tap | unique) | join(' ') }}"

View File

@@ -2,6 +2,12 @@
---
# create all the facts used throughout the role, but shouldn't be touched
# by the user
- name: Create temporary directory for downloads
ansible.builtin.tempfile:
state: directory
prefix: ansible_role_package.
register: d_tempdir
- name: Set installation facts
ansible.builtin.include_tasks:
file: facts.yml

View File

@@ -1,7 +1,7 @@
# vim: set filetype=yaml.ansible :
---
- name: Install npm pkg
become: "{{ archive_become }}"
become: "{{ ext_become }}"
community.general.npm:
global: true
name: "{{ pkg }}"

View File

@@ -1,7 +1,7 @@
# vim: set filetype=yaml.ansible :
---
- name: Install pipx pkg
become: "{{ archive_become }}"
become: "{{ ext_become }}"
community.general.pipx:
executable: "{{ pipx_exec }}"
name: "{{ pipx_pkg }}"

View File

@@ -3,6 +3,8 @@
- name: Append to pkg_sys and pkg_cargo
when:
- ansible_system == 'Linux'
notify:
- Depend cargo
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + broot.deps }}"
pkg_cargo: "{{ pkg_cargo + [broot] }}"

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

@@ -0,0 +1,3 @@
- name: Append to pkg_sys
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['direnv'] }}"

View File

@@ -3,6 +3,7 @@
- name: Source pkg installation
when:
- ghostty.method == 'src'
- ansible_distribution != 'MacOSX'
notify:
- Depend zig
block:

View File

@@ -2,12 +2,11 @@
---
- name: Install from archive
when:
- go.use_archive
- go.method == 'archive'
ansible.builtin.set_fact:
pkg_archive: "{{ pkg_archive + ['go'] }}"
- name: Append to pkgs
when:
- not go.use_archive
- go.method != 'archive'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['go'] }}"

View File

@@ -1,20 +1,19 @@
# vim: set filetype=yaml.ansible :
---
- name: Append to flatpkgs
- name: Append to pkg_flatpak
when:
- libreoffice.method == 'flatpak'
ansible.builtin.set_fact:
flatpkgs: "{{ flatpkgs + libreoffice.flatpak }}"
pkg_flatpak: "{{ pkg_flatpak + libreoffice.flatpak }}"
- name: Append to pkg_sys
when:
- libreoffice.method == 'sys'
- ansible_system == 'Linux'
ansible.builtin.set_fact:
sys_pkg: "{{ sys_pkg + libreoffice.pkgs }}"
- name: Append to caskpkgs
when:
- ansible_system == 'Darwin'
- libreoffice.method == 'cask'
ansible.builtin.set_fact:
pkg_cask: "{{ pkg_cask + ['libreoffice'] }}"
pkg_cask: "{{ pkg_cask + libreoffice.pkgs }}"

View File

@@ -2,12 +2,12 @@
---
- name: Append to appimages
when:
- nvim.method == 'appimage'
- neovim.method == 'appimage'
ansible.builtin.set_fact:
pkg_appimage: "{{ pkg_appimage + ['neovim'] }}"
- name: Append neovim to pkg_sys
when:
- nvim.method == 'sys'
- neovim.method == 'sys'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['neovim'] }}"

View File

@@ -2,4 +2,4 @@
---
- name: Append to pkgs
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + pkgconfig.nodejs.pkgs[ansible_system] }}"
pkg_sys: "{{ pkg_sys + nodejs.pkgs }}"

View File

@@ -2,14 +2,14 @@
---
- name: Append to pkg_flatpak
when:
- ansible_system == 'Linux'
- pgadmin.method == 'flatpak'
notify:
- Depend flatpak
ansible.builtin.set_fact:
pkg_flatpak: "{{ pkg_flatpak + [pkgconfig.pgadmin.flatpak] }}"
pkg_flatpak: "{{ pkg_flatpak + [pgadmin.flatpak] }}"
- name: Append to pkg_cask
when:
- ansible_system == 'Darwin'
- pgadmin.method == 'cask'
ansible.builtin.set_fact:
pkg_cask: "{{ pkg_cask + ['pgadmin4'] }}"
pkg_cask: "{{ pkg_cask + pgadmin.pkgs }}"

View File

@@ -2,4 +2,4 @@
---
- name: Append to pkgs
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + pkgconfig.rust.pkgs }}"
pkg_sys: "{{ pkg_sys + rust.pkgs }}"

View File

@@ -3,5 +3,15 @@
- name: Append to pkgs
notify:
- Depend hashicorp repo
ansible.builtin.set_fact:
pkg_taps: "{{ pkg_taps + [pkgconfig.terraform[ansible_system]] }}"
block:
- name: MacOSX specific
when:
- ansible_distribution == 'MacOSX'
ansible.builtin.set_fact:
pkg_tap: "{{ pkg_tap + terraform.pkgs }}"
- name: Linux specific
when:
- ansible_system == 'Linux'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + terraform.pkgs }}"

View File

@@ -8,10 +8,10 @@
when:
- ansible_system == 'Darwin'
ansible.builtin.set_fact:
pkg_taps: "{{ pkg_taps + [pkgconfig.terraformls[ansible_system]] }}"
pkg_tap: "{{ pkg_tap + terraformls.pkgs }}"
- name: Linux specific
when:
- ansible_system == 'Linux'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['terraformls'] }}"
pkg_sys: "{{ pkg_sys + terraformls.pkgs }}"

View File

@@ -2,4 +2,4 @@
---
- name: Append to pkg_sys
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + pkgconfig.tidy.pkgs[ansible_system] }}"
pkg_sys: "{{ pkg_sys + tidy.pkgs }}"

View File

@@ -8,7 +8,7 @@
when:
- ansible_system == 'Darwin'
ansible.builtin.set_fact:
pkg_taps: "{{ pkg_taps + [pkgconfig.vault[ansible_system]] }}"
pkg_tap: "{{ pkg_tap + [pkgconfig.vault[ansible_system]] }}"
- name: Linux specific
when:

View File

@@ -4,4 +4,4 @@
notify:
- Depend zig
ansible.builtin.set_fact:
pkg_src: "{{ pkg_src + ['zls'] }}"
pkg_archive: "{{ pkg_archive + ['zls'] }}"

View File

@@ -34,15 +34,9 @@
when:
- ansible_os_family == 'Debian'
block:
- name: Create temporary directory
ansible.builtin.tempfile:
state: directory
prefix: hashicorp.
register: d_hashicorp_tmp
- name: Get hashicorp archive gpg key
ansible.builtin.get_url:
dest: "{{ d_hashicorp_tmp.path }}/gpg"
dest: "{{ d_tempdir.path }}/hashicorp_gpg"
url: https://apt.releases.hashicorp.com/gpg
mode: '0644'
@@ -55,7 +49,7 @@
- --dearmor
- -o
- /usr/share/keyrings/hashicorp-archive-keyring.gpg
- "{{ d_hashicorp_tmp.path }}/gpg"
- "{{ d_tempdir.path }}/hashicorp_gpg"
- name: Enable hasicorp repo for debian
ansible.builtin.apt_repository:
@@ -66,8 +60,5 @@
- name: MacOS specific configuration
when:
- ansible_distribution == 'MacOSX'
block:
- name: Enable hashicorp homebrew tap
when: ansible_os_family == 'Darwin'
ansible.builtin.set_fact:
brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}"
ansible.builtin.set_fact:
brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}"

View File

@@ -2,32 +2,16 @@
---
- name: Build ghostty from source
block:
- name: Create temp path
ansible.builtin.tempfile:
state: directory
prefix: ghostty.
register: d_ghostty_tmp
- name: Clone ghostty git repository
ansible.builtin.git:
depth: 1
dest: "{{ d_ghostty_tmp.path }}/ghostty"
repo: "{{ pkgconfig_ghostty.git_repo }}"
version: "{{ pkgconfig_ghostty.version }}"
dest: "{{ d_tempdir.path }}/ghostty"
repo: "{{ ghostty.repo }}"
version: "{{ ghostty.vers }}"
- name: Build ghostty
ansible.builtin.command:
chdir: "{{ d_ghostty_tmp.path }}/ghostty"
cmd: "zig build -D{{ pkgconfig_ghostty.optimize }}"
become: "{{ ext_become }}"
register: c_ghostty_build
- name: Install ghostty
ansible.file.copy:
src: "{{ d_ghostty_tmp.path }}/ghostty/zig-out/bin/ghostty"
dest: "{{ pkgconfig_ghostty.install_prefix }}/bin/ghostty"
owner: "{{ pkgconfig_ghostty.owner }}"
group: "{{ pkgconfig_ghostty.group }}"
mode: "0755"
remote_src: true
become: "{{ pkgconfig_ghostty.become }}"
become_user: "{% if pkgconfig_ghostty.become %}{{ pkgconfig_ghostty.owner }}{% else %}~{% endif %}"
ansible.builtin.command:
chdir: "{{ d_tempdir.path }}/ghostty"
cmd: "zig build -p {{ path.prefix }} -D{{ pkgconfig_ghostty.optimize }}"

View File

@@ -14,12 +14,10 @@
version: "{{ pkgconfig_neovim.version }}"
- name: Build and install neovim
become: "{{ ext_become }}"
ansible.builtin.make:
chdir: "{{ d_nvim_tmp.path }}/neovim"
chdir: "{{ d_tempdir.path }}/neovim"
params:
CMAKE_BUILD_TYPE: "{{ pkgconfig_neovim.build_type }}"
CMAKE_INSTALL_PREFIX: "{{ pkgconfig_neovim.install_prefix }}"
CMAKE_BUILD_TYPE: "{{ neovim.build_type }}"
CMAKE_INSTALL_PREFIX: "{{ path.prefix }}"
target: install
become: "{{ pkgconfig_neovim.dobecome }}"
become_user: "{% if pkgconfig_neovim.dobecome %}{{ pkgconfig_neovim.owner }}{% else %}~{% endif %}"
when: not pkgconfig_neovim.use_appimage