make the packages role more generic

This commit is contained in:
Matthew Stobbs
2025-01-18 09:24:11 -07:00
parent 3d466e64c7
commit 333ee4c3f5
112 changed files with 1610 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
---
- name: install rust and cargo
ansible.builtin.include_tasks:
file: "packages/{{ ansible_os_family }}/rust.yml"
tags:
- rust
- dependency
- name: set alacritty pkg deps
set_fact:
alacritty_deps:
- cmake
- freetype-devel
- fontconfig-devel
- libxcb-devel
- libxkbcommon-devel
- g++
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + alacritty_deps }}"
altpkgs: "{{ (altpkgs | default([])) + [ 'packages/Linux/alacritty.yml' ] }}"
tags:
- syspkgs
- altpkgs

7
tasks/RedHat/ansible.yml Normal file
View File

@@ -0,0 +1,7 @@
# Install ansible for current platform
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'ansible' ] }}"

5
tasks/RedHat/btop.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'btop' ] }}"

View File

@@ -0,0 +1,7 @@
---
- name: install carapace RPM
become: true
ansible.builtin.dnf:
name: https://github.com/carapace-sh/carapace-bin/releases/download/v1.0.7/carapace-bin_1.0.7_linux_amd64.rpm
state: present
disable_gpg_check: true

9
tasks/RedHat/cmake.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'cmake' ] }}"
tags:
- RedHat
- linux
- package

9
tasks/RedHat/consul.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- name: ensure hashicorp repo is active
ansible.builtin.include_tasks:
file: packages/{{ ansible_os_family }}/hashicorp_repo.yml
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'consul' ] }}"

View File

@@ -0,0 +1,8 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'editorconfig' ] }}"
tags:
- RedHat
- linux
- package

9
tasks/RedHat/firefox.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'firefox' ] }}"
tags:
- packages
- RedHat
- web

10
tasks/RedHat/fzf.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'fzf' ] }}"
tags:
- RedHat
- linux
- package

15
tasks/RedHat/ghostty.yml Normal file
View File

@@ -0,0 +1,15 @@
---
- name: ensure dependencies
ansible.builtin.include_tasks:
file: packages/RedHat/terra_repo.yml
tags:
- dependency
- package
- terra
- syspkgs
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'ghostty' ] }}"
tags:
- syspkgs

10
tasks/RedHat/git.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'git', 'git-delta', 'git-email', 'git-lfs' ] }}"
tags:
- RedHat
- linux
- package

5
tasks/RedHat/go.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- name: append to pkgs
set_fact:
altpkgs: "{{ (altpkgs | default([])) + [ 'packages/Linux/go.yml' ] }}"

View File

@@ -0,0 +1,27 @@
# install hashicorp vault for RedHat
---
- name: enable hashicorp repo for fedora >=41
become: true
when:
- ansible_distribution == 'Fedora'
- ansible_distribution_major_version|int >= 41
ansible.builtin.command:
creates: /etc/yum.repos.d/hashicorp.repo
cmd: dnf config-manager addrepo --from-repofile=https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
- name: enable hashicorp repo for fedora <41
become: true
when:
- ansible_distribution == 'Fedora'
- ansible_distribution_major_version|int < 41
ansible.builtin.command:
creates: /etc/yum.repos.d/hashicorp.repo
cmd: dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
- name: enable hashicorp repo for RHEL like distribution
become: true
when:
- ansible_distribution != 'Fedora'
ansible.builtin.command:
creates: /etc/yum.repos.d/hashicorp.repo
cmd: dnf config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo

10
tasks/RedHat/hugo.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'hugo' ] }}"
tags:
- RedHat
- linux
- package

10
tasks/RedHat/jq.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'jq' ] }}"
tags:
- RedHat
- linux
- package

9
tasks/RedHat/konsole.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'konsole' ] }}"
tags:
- RedHat
- linux
- package

19
tasks/RedHat/neovide.yml Normal file
View File

@@ -0,0 +1,19 @@
---
- name: set neovide pkg dependencies
set_fact:
neovide_deps:
- cargo
- fontconfig-devel
- freetype-devel
- libX11-xcb
- libX11-devel
- libstdc++-static
- libstdc++-devel
- "@Development Tools"
- "@Development Libraries"
- name: append to pkgs
when: ansible_architecture != "aarch64"
set_fact:
syspkgs: "{{ (syspkgs | default([])) + neovide_deps }}"
altpkgs: "{{ (altpkgs | default([])) + [ 'packages/Linux/neovide.yml' ] }}"

22
tasks/RedHat/neovim.yml Normal file
View File

@@ -0,0 +1,22 @@
---
- name: append to pkgs
when: ansible_distribution == "Fedora"
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'neovim', 'python3-neovim' ] }}"
tags:
- RedHat
- linux
- package
- name: Install neovim appimage
when: ansible_distribution != "Fedora"
become: true
ansible.builtin.get_url:
url: https://github.com/neovim/neovim/releases/download/v0.10.0/nvim.appimage
dest: /usr/local/bin/nvim
checksum: sha256:6a021e9465fe3d3375e28c3e94c1c2c4f7d1a5a67e4a78cf52d18d77b1471390
tags:
- RedHat
- linux
- package

View File

@@ -0,0 +1,4 @@
---
- name: append to pkgs
set_fact:
altpkgs: "{{ (altpkgs | default([])) + [ 'packages/Linux/nerdfonts.yml' ] }}"

10
tasks/RedHat/nodejs.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'nodejs', 'npm' ] }}"
tags:
- RedHat
- linux
- package

9
tasks/RedHat/nomad.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- name: ensure hashicorp repo is active
ansible.builtin.include_tasks:
file: packages/{{ ansible_os_family }}/hashicorp_repo.yml
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'nomad' ] }}"

16
tasks/RedHat/nushell.yml Normal file
View File

@@ -0,0 +1,16 @@
---
- name: install RedHat dependencies
set_fact:
nushell_pkgdeps:
- cargo
- libxcb
- openssl-devel
- libX11-devel
nushell_altdeps:
- packages/Linux/nushell.yml
- packages/{{ ansible_os_family }}/carapace.yml
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + nushell_pkgdeps }}"
altpkgs: "{{ (altpkgs | default([])) + nushell_altdeps }}"

8
tasks/RedHat/packer.yml Normal file
View File

@@ -0,0 +1,8 @@
---
- name: ensure hashicorp repo is active
ansible.builtin.include_tasks:
file: packages/{{ ansible_os_family }}/hashicorp_repo.yml
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'packer' ] }}"

10
tasks/RedHat/pandoc.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'pandoc' ] }}"
tags:
- RedHat
- linux
- package

9
tasks/RedHat/pipx.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'pipx' ] }}"
tags:
- RedHat
- linux
- package

View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'python3-pip' ] }}"
tags:
- RedHat
- linux
- package

10
tasks/RedHat/ripgrep.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'ripgrep' ] }}"
tags:
- RedHat
- linux
- package

14
tasks/RedHat/rust.yml Normal file
View File

@@ -0,0 +1,14 @@
---
- name: set rust_pkgs
set_fact:
rust_pkgs:
- rustc
- cargo
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + rust_pkgs }}"
tags:
- RedHat
- linux
- package

10
tasks/RedHat/stow.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'stow' ] }}"
tags:
- RedHat
- linux
- package

12
tasks/RedHat/terminal.yml Normal file
View File

@@ -0,0 +1,12 @@
---
# default on Linux is alacritty
# edit config/users.yml:users:<user item>:terminal:os_name:package name
# ie: config/users.yml:users:[name: stobbsm]:terminal:Fedora:konsole
- name: install and configure system terminal emulator
loop: "{{ users }}"
ansible.builtin.include_tasks:
file: "packages/{{ ansible_os_family }}/{{ item.terminal[ansible_distribution] | default('alacritty') }}.yml"
tags:
- package
- RedHat

View File

@@ -0,0 +1,22 @@
---
- name: enable terra repo for fedora >=41
become: true
when:
- ansible_distribution == 'Fedora'
- ansible_distribution_major_version|int >= 41
ansible.builtin.command:
creates: /etc/yum.repos.d/terra.repo
cmd: dnf install -y --nogpgcheck --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' terra-release
- name: enable terra repo for fedora <41
when:
- ansible_distribution == 'Fedora'
- ansible_distribution_major_version|int < 41
block:
- ansible.builtin.command:
creates: /etc/yum.repos.d/terra.repo
cmd: dnf config-manager --add-repo https://terra.fyralabs.com/terra.repo
become: true
- ansible.builtin.dnf:
name: terra-release
state: present

View File

@@ -0,0 +1,8 @@
---
- name: ensure hashicorp repo is active
ansible.builtin.include_tasks:
file: packages/{{ ansible_os_family }}/hashicorp_repo.yml
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'terraform' ] }}"

10
tasks/RedHat/tidy.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'tidy' ] }}"
tags:
- RedHat
- linux
- package

10
tasks/RedHat/tmux.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'tmux' ] }}"
tags:
- RedHat
- linux
- package

9
tasks/RedHat/vault.yml Normal file
View File

@@ -0,0 +1,9 @@
# install hashicorp vault for RedHat
---
- name: ensure hashicorp repo is active
ansible.builtin.include_tasks:
file: packages/{{ ansible_os_family }}/hashicorp_repo.yml
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'vault' ] }}"

14
tasks/RedHat/vivaldi.yml Normal file
View File

@@ -0,0 +1,14 @@
---
- name: Configure RPM Repository
become: true
ansible.builtin.yum_repository:
name: vivaldi
baseurl: "https://repo.vivaldi.com/archive/rpm/{{ ansible_architecture }}"
description: vivaldi browser
gpgcheck: true
gpgkey: https://repo.vivaldi.com/archive/linux_signing_key.pub
state: present
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'vivaldi-stable' ] }}"

65
tasks/RedHat/zfs.yml Normal file
View File

@@ -0,0 +1,65 @@
---
- name: set rpm_dist
ansible.builtin.command: rpm --eval "%{dist}"
register: rpm_dist
tags:
- packages
- RedHat
- config
- name: set zfs repo facts
set_fact:
zfs_repo_base: https://zfsonlinux.org
zfs_gpg_key: https://raw.githubusercontent.com/zfsonlinux/zfsonlinux.github.com/master/zfs-release/RPM-GPG-KEY-openzfs-key2
zfs_gpg_key_fingerprint: 7DC7 299D CF7C 7FD9 CD87 701B A599 FD5E 9DB8 4141
- name: el9+ specific configuration
block:
- name: set el9+ facts
set_fact:
rh_release: epel
zfs_release: 2-3
when:
- ansible_distribution != 'Fedora'
# TODO: figure out a better way to identify EPEL based distros
# TODO: Alma, rocky, centos, rhel
tags:
- packages
- RedHat
- config
- name: Fedora specific configuration
block:
- name: set fedora facts
set_fact:
rh_release: fedora
zfs_release: 2-6
when: ansible_distribution == 'Fedora'
when: ansible_distribution == 'Fedora'
- name: add openzfs gpg_key
ansible.builtin.rpm_key:
key: "{{ zfs_gpg_key }}"
fingerprint: "{{ zfs_gpg_key_fingerprint }}"
state: present
become: true
tags:
- packages
- RedHat
- name: enable openzfs repository
ansible.builtin.dnf:
name: "{{ zfs_repo_base }}{{ rh_release }}/zfs-release-{{ zfs_release }}{{ rpm_dist.stdout }}.noarch.rpm"
state: "{{ install_state }}"
become: true
tags:
- packages
- RedHat
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'zfs' ] }}"
become: true
tags:
- RedHat
- packages

17
tasks/RedHat/zoxide.yml Normal file
View File

@@ -0,0 +1,17 @@
---
- name: Enable copr repo for zoxide
become: true
when: ansible_distribution != "Fedora"
community.general.copr:
name: atim/zoxide
state: enabled
chroot: "{{ coprChroot[ansible_distribution].chroot | default(omit) }}"
- name: append to pkgs
set_fact:
syspkgs: "{{ (syspkgs | default([])) + [ 'zoxide' ] }}"
tags:
- RedHat
- linux
- package