Working on source packages

Signed-off-by: Matthew Stobbs <matthew@stobbs.ca>
This commit is contained in:
Matthew Stobbs
2026-02-02 02:35:16 -07:00
parent fa78c0aa0c
commit c613a29ce4
14 changed files with 470 additions and 396 deletions

View File

@@ -1,13 +0,0 @@
# vim: set filetype=yaml.ansible :
---
- name: Depend terra repo
ansible.builtin.include_tasks:
file: repos/terra.yml
- name: Depend hashicorp repo
ansible.builtin.include_tasks:
file: repos/hashicorp.yml
- name: Depend zfs repo
ansible.builtin.include_tasks:
file: repos/zfs.yml

View File

@@ -5,10 +5,61 @@ argument_specs:
short_description: Install software using ansible short_description: Install software using ansible
description: description:
- Make the installation of packages consistent on each platform. - Make the installation of packages consistent on each platform.
- Installs for RedHat, Debian and MacOS based systems. - Will install via system package managers, source, or specific install tool. For example, a go package installed via source will run `go install`.
author: maintainers:
- Matthew Stobbs <matthew@stobbs.ca> - Matthew Stobbs
options: options:
packages:
type: list
elements: str
required: true
description:
- List of packages to install using this role's package name.
- See README.md for the list of available packages.
install_become:
type: bool
default: true
description:
- Install packages using privilege elevation.
install_become_user:
type: bool
default: root
description:
- User to become when install_become is true.
install_method:
type: str
default: system
description:
- Install packages using system package manager when available.
- When a package doesn't have a system install candidate for the host, it uses it's default install method as defined in the pkglist variables called `<pkgname>_install_methods`
- Most packages will be either `system` or `source` installs.
- System installs default to using the system package manager, if possible.
- Source installs download, build and install the package via source code. Source installs could be of different types based on the language. For example; python packages installed using `source` are installed with either pipx (default) or system pip.
choices:
- system
- source
python_package_method:
type: str
default: pipx
description:
- How to install pip packages.
choices:
- pipx
- system
install_prefix:
type: str
required: false
default: /usr/local
description:
- The prefix to use for non-system package installs.
- All package files will be installed using the directory prefixed by this prefix.
extra_ldd_paths:
type: list
elements: path
required: false
default: []
description:
- Paths to add to the ld.so.conf path list. Will create a file in `/etc/ld.so.conf.d/` on most systems.
packages: packages:
type: list type: list
elements: str elements: str
@@ -16,80 +67,84 @@ argument_specs:
description: description:
- The list of packages to install by name. - The list of packages to install by name.
- The list must contain only values that exist in B(Available Packages) in README.md - The list must contain only values that exist in B(Available Packages) in README.md
extra_packages: packages_extra:
type: list type: list
elements: str elements: str
required: false
default: []
description: description:
- Extra system packages by installation name to install using the system package manager - Extra system packages by installation name to install using the system package manager
- These are installed directly using the system package manager
flatpak_default_remote:
type: str
required: false
default: flathub
description:
- the Default remote name to use with flatpak installation.
flatpak_method: flatpak_method:
type: str type: str
required: false
default: system default: system
description: description:
- Default installation method for flatpaks. - Default installation method for flatpaks.
- Possible values are 'system' and 'user' - Possible values are 'system' and 'user'.
install_method: - Only applies to linux distros.
type: str flatpak_remotes:
default: system type: list
choices: elements: dict
- system required: false
- source default:
- appimage - name: flathub
- flatpak url: https://dl.flathub.org/repo/flathub.flatpakrepo
- snap
description: description:
- Default installation method for packages. - List of flatpak remotes to add to the system.
- Varies between each indivdual package, but this is for overall package installation. - Does not remove pre existing flatpak repos.
- Possible values are V(system), V(source), V(appimage), V(flatpak), V(snap) clean_install:
- When using MacOS, the V(system) option uses homebrew by default.
install_prefix:
type: path
default: /usr/local
description:
- Default installation prefix when installation non-system packages.
store_path:
type: path
default: ANSIBLE_USER_DIR/.cache/ansible_role_package
description:
- Where to store cached files like archives and git repos
clean_source:
type: bool type: bool
default: false default: false
description: description:
- Remove existing installation of package before installing - Remove existing installation of package before installing.
path_appimage: path_appimage:
type: path type: path
default: INSTALL_PREFIX/appimage default: /usr/local/appimage
description: description:
- Where appimage files are stored. - Where appimage files are stored.
path_archive: path_archive:
type: path type: path
default: INSTALL_PREFIX/archive default: /usr/local/archive
description: description:
- Where archives are extracted. - Where archives are extracted.
path_bin: path_bin:
type: path type: path
default: INSTALL_PREFIX/bin default: /usr/local/bin
description: description:
- Where binaries are installed or linked. - Where binaries are installed or linked.
- Needs to be added to your PATH - Needs to be added to your PATH to be usable.
path_cargo: path_cargo:
type: path type: path
default: INSTALL_PREFIX/cargo default: /usr/local/cargo
description: description:
- Where cargo installs it's packages - Where cargo installs it's packages
path_go: path_go:
type: path type: path
default: INSTALL_PREFIX/go default: /usr/local/go
description: description:
- Where go is installed. Equivalent of GOROOT. - Where go is installed. Equivalent of GOROOT.
path_pipx: path_pipx:
type: path type: path
default: INSTALL_PREFIX/pipx default: /usr/local/pipx
description: description:
- Where pipx installs it's virtual environments - Where pipx installs it's virtual environments
use_become: store_path:
type: bool type: path
default: true default: /<ansible_user_dir>/.cache/ansible_role_package
required: false
description: description:
- Elevate privileges when installing non-system packages. - Where cached files are kept, such as git repositories.
- Building will be done as the ansible user, elevating only when installing. - Packages that are compiled have their source extracted here.
clean_cache:
type: bool
default: false
description:
- Clean the V(store_path) after completing package install.
- Removes source code, archives and git repositories

View File

@@ -8,51 +8,15 @@
- name: Set package_home_base for Linux - name: Set package_home_base for Linux
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux' or
ansible_os_family == 'FreeBSD'
ansible.builtin.set_fact: ansible.builtin.set_fact:
package_home_base: /home package_home_base: /home
- name: Set defaults paths
ansible.builtin.set_fact:
install_prefix: "{{ install_prefix | default(default_install_prefix) }}"
default_store_path: "{{ ansible_user_dir }}/.cache/ansible_role_package"
default_path_appimage: "{{ install_prefix | default(default_install_prefix) }}/appimage"
default_path_archive: "{{ install_prefix | default(default_install_prefix) }}/archive"
default_path_bin: "{{ install_prefix | default(default_install_prefix) }}/bin"
default_path_cargo: "{{ install_prefix | default(default_install_prefix) }}/cargo"
default_path_go: "{{ install_prefix | default(default_install_prefix) }}/go"
default_path_pipx: "{{ install_prefix | default(default_install_prefix) }}/pipx"
- name: Set install variables
ansible.builtin.set_fact:
store_path: "{{ store_path | default(default_store_path) }}"
path_appimage: "{{ path_appimage | default(default_path_appimage) }}"
path_archive: "{{ path_archive | default(default_path_archive) }}"
path_bin: "{{ path_bin | default(default_path_bin) }}"
path_cargo: "{{ path_cargo | default(default_path_cargo) }}"
path_go: "{{ path_go | default(default_path_go) }}"
path_pipx: "{{ path_pipx | default(default_path_pipx) }}"
- name: Set OS independant facts
ansible.builtin.set_fact:
pkg_archive: [] # packages installed via prebuilt archive
pkg_cargo: [] # rust packages from cargo using `cargo install`
pkg_cargo_build: [] # rust packages using `cargo build` before install
pkg_go: [] # go applications
pkg_npm: [] # npm commands
pkg_pipx: [] # pipx packages
pkg_src: [] # packages built from source
pkg_sys: [] # system package manager packages, homebrew on macOS, dnf for RedHat based, apt for Debian Based
pkg_zig: [] # zig packages
- name: Set Linux specific facts - name: Set Linux specific facts
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
ansible.builtin.set_fact: ansible.builtin.set_fact:
flatpak_remotes: "{{ default_flatpak_remotes }}"
pkg_appimage: [] # appimages to install
pkg_flatpak: [] # flatpak packages to install
pkg_snap: [] # snpacraft.io packages
pipx_exec: "/usr/bin/pipx" pipx_exec: "/usr/bin/pipx"
path_lib: lib64 path_lib: lib64
root_prefix: /usr/local root_prefix: /usr/local

View File

@@ -1,5 +0,0 @@
# vim: set filetype=yaml.ansible :
---
- name: "Add include task for {{ pkg }}"
ansible.builtin.include_tasks:
file: "pkgs/{{ pkg }}.yml"

29
tasks/helpers/archive.yml Normal file
View File

@@ -0,0 +1,29 @@
# vim: set filetype=yaml.ansible :
---
- name: Extract archive to given path
block:
- name: Ensure directory exists
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.bulitin.file:
state: directory
path: "{{ extract_path }}"
mode: "{{ install_prefix_mode }}"
owner: "{{ install_prefix_owner }}"
group: "{{ install_prefix_group }}"
- name: Download archive to cache
ansible.builtin.get_url:
dest: "{{ d_cache }}/{{ archive_name }}"
url: "{{ archive_url }}"
checksum: "{{ archive_checksum }}"
decompress: false
mode: '0644'
- name: Extract go archive
ansible.builtin.unarchive:
dest: "{{ extract_path }}"
src: "{{ d_cache }}/{{ archive_name }}"
remote_src: true
include: "{{ archive_include | default(omit) }}"
exclude: "{{ archive_exclude | default(omit) }}"

View File

@@ -1,110 +1,89 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
# create all the facts used throughout the role, but shouldn't be touched
# by the user
- name: Create cache directory
register: d_cache
ansible.builtin.file:
path: "{{ store_path }}"
mode: '0777'
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
state: directory
- name: Set installation facts - name: Set installation facts
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: facts.yml file: facts.yml
- name: Ensure directory exists {{ path.prefix }} - name: Create cache directory
become: "{{ ext_become }}" register: d_cache
ansible.builtin.file:
path: "{{ store_path }}"
mode: '0755'
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
state: directory
- name: Ensure required paths exists
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop:
- "{{ install_prefix }}"
- "{{ path_appimage }}"
- "{{ path_archive }}"
- "{{ path_bin }}"
- "{{ path_cargo }}"
- "{{ path_git }}"
- "{{ path_pipx }}"
loop_control:
loop_var: path
ansible.builtin.file: ansible.builtin.file:
state: directory state: directory
mode: '0755' mode: '0755'
path: "{{ path.prefix }}" owner: "{{ install_prefix_owner }}"
group: "{{ install_prefix_group }}"
path: "{{ path }}"
- name: Ensure directory exists {{ path.bin }} - name: Read package configuration
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.bin }}"
- name: Read default package configuration
ansible.builtin.include_vars: ansible.builtin.include_vars:
dir: pkgs file: pkglist.yml
extensions:
- yml
name: pkgconfig
- name: Read default package configuration - name: Add needed packages for Fedora
ansible.builtin.include_vars: when:
dir: src - ansible_distribution == 'Fedora'
extensions:
- yml
name: srcconfig
- name: Append system_packages to pkg_sys
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + extra_packages }}" pkg_sys: "{{ packages_extra + ['python3-paramiko'] }}"
- name: Add needed MacOS packages
when:
- ansible_distribution == 'MacOSX'
ansible.builtin.set_fact:
pkg_sys: "{{ packages_extra + ['gnu-tar', 'virtualenv'] }}"
- name: Add needed Alpine packages
when:
- ansible_os_family == 'Alpine'
ansible.builtin.set_fact:
pkg_sys: "{{ packages_extra + ['tar', 'unzip'] }}"
- name: Append extra packages to system install list
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + packages_extra }}"
- name: Generate package installation lists - name: Generate package installation lists
loop: "{{ packages | unique }}" loop: "{{ packages | unique }}"
loop_control: loop_control:
loop_var: pkg loop_var: pkg
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: addpkg.yml file: "pkgs/{{ pkg }}.yml"
- name: Flush handlers to ensure dependencies are installed - name: Install go if required
ansible.builtin.meta: flush_handlers
- name: Add needed packages for Fedora
when: when:
- ansible_distribution == 'Fedora' - pkg_go|length > 0
ansible.builtin.set_fact: ansible.builtin.include_tasks:
pkg_sys: "{{ pkg_sys + ['python3-paramiko'] }}" file: pkgs/go.yml
- name: Add needed MacOS packages - name: Install rust and cargo if required
when: when:
- ansible_distribution == 'MacOSX' - pkg_cargo|length > 0 or
ansible.builtin.set_fact: pkg_cargo_build|length > 0
pkg_sys: "{{ pkg_sys + ['gnu-tar', 'virtualenv'] }}" ansible.builtin.include_tasks:
file: pkgs/rust.yml
- name: Add needed Alpine packages - name: Ensure pipx is installed
when: when:
- ansible_os_family == 'Alpine' - pkg_pipx|length > 0
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['tar', 'unzip'] }}"
- name: Ensure extra dependencies are installed
block:
- name: Ensure go binary is installed
when: pkg_go|length > 0
vars:
pkg: go
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: addpkg.yml file: pkgs/pipx.yml
- name: Ensure go path exists
become: "{{ ext_become }}"
when: pkg_go|length > 0
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.go }}"
- name: Ensure rust and cargo are installed
when: pkg_cargo|length > 0
vars:
pkg: rust
ansible.builtin.include_tasks:
file: addpkg.yml
- name: Ensure pipx is installed
when: pkg_pipx|length > 0
vars:
pkg: pipx
ansible.builtin.include_tasks:
file: addpkg.yml
- name: Ensure pipx path exists - name: Ensure pipx path exists
when: pkg_pipx|length > 0 when: pkg_pipx|length > 0
@@ -141,12 +120,14 @@
path: "{{ path.appimage }}" path: "{{ path.appimage }}"
- name: Ensure archive path exists - name: Ensure archive path exists
when: pkg_archive|length > 0 when:
become: "{{ ext_become }}" - pkg_archive|length > 0
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.file: ansible.builtin.file:
state: directory state: directory
mode: '0755' mode: '0755'
path: "{{ path.archive }}" path: "{{ path_archive }}"
- name: Depend zig - name: Depend zig
when: pkg_zig|length > 0 when: pkg_zig|length > 0

View File

@@ -1,36 +1,29 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Set air configuration - name: Set air configuration # {{{
when: when:
- __air_configured is undefined or - __air_configured is undefined or
not __air_configured not __air_configured
block: block:
- name: Set air_install_method - name: Set air install method
when: when:
- air_install_method is undefined - air_install_method is undefined
ansible.builtin.set_fact: ansible.builtin.set_fact:
air_install_method: source air_install_method: "{% if install_method in air_install_methods %}{{ install_method }}{% else %}{{ air_install_method[0] }}{% endif %}"
- name: Set air version and url - name: Set air version and url
ansible.builtin.set_fact: ansible.builtin.set_fact:
air_version: "{{ air_version | default('latest') }}" air_version: "{{ air_version | default('latest') }}"
air_url: "{{ air_url | default('github.com/air-verse/air') }}" air_install_url: "{{ air_install_url | default('github.com/air-verse/air') }}"
- name: Set air install path - name: Set air install package
ansible.builtin.set_fact: ansible.builtin.set_fact:
air_pkg: "{{ air_url }}@{{ air_version }}" air_pkg: "{{ air_install_url }}@{{ air_version }}"
- name: Ensure air_install_method is valid
when:
- air_install_method is defined
- air_install_method not in air_install_methods
ansible.builtin.set_fact:
air_intall_method: air_install_methods[0]
- name: Complete air configuration - name: Complete air configuration
ansible.builtin.set_fact: ansible.builtin.set_fact:
__air_configured: true __air_configured: true
# }}}
- name: Append air to pkg_go - name: Append air to pkg_go
when: when:
- air_install_method == 'source' - air_install_method == 'source'

View File

@@ -5,28 +5,23 @@
- __alacritty_configured is undefined or - __alacritty_configured is undefined or
not __alacritty_configured not __alacritty_configured
block: block:
- name: Set install method
when:
- alacritty_install_method is undefined
ansible.builtin.set_fact:
alacritty_install_method: "{% if default_install_method in alacritty_install_methods %}{{ default_install_method }}{% else %}{{ alacritty_install_methods[0] }}{% endif %}"
- name: Set basic variables - name: Set basic variables
ansible.builtin.set_fact: ansible.builtin.set_fact:
alacritty_version: v0.16.1 alacritty_version: "{{ alacritty_version | default('v0.16.1') }}"
alacritty_git_repo: https://github.com/alacritty/alacritty alacritty_git_repo: "{{ alacritty_git_repo | default('https://github.com/alacritty/alacritty') }}"
alacritty_pkgname: alacritty alacritty_pkgname: "{{ alacritty_pkgname | default('alacritty') }}"
alacritty_build_deps_extra: []
- name: Set install type
when:
- alacritty_install_method is undefined or
alacritty_install_method == ''
ansible.builtin.set_fact:
alacritty_install_method: system
- name: Install via source
when:
- alacritty_install_method is defined
- alacritty_install_method == 'source' or
install_method == 'source'
block:
- name: Configure alacritty source install - name: Configure alacritty source install
when:
- alacritty_install_method == "source"
ansible.builtin.set_fact: ansible.builtin.set_fact:
alacritty_install_method: source
alacritty_src_install: alacritty_src_install:
cargo_build_flags: cargo_build_flags:
- --release - --release
@@ -43,16 +38,8 @@
files_list: files_list:
- bin/alacritty - bin/alacritty
- share/pixmaps/Alacritty.svg - share/pixmaps/Alacritty.svg
- name: Set alacritty install options
block:
- name: Set options for RedHat based Linux
when:
- ansible_os_family == 'RedHat'
block:
- name: Set common build dependencies
ansible.builtin.set_fact:
alacritty_build_deps: alacritty_build_deps:
RedHat:
- cmake - cmake
- fontconfig-devel - fontconfig-devel
- freetype-devel - freetype-devel
@@ -60,24 +47,7 @@
- libxcb-devel - libxcb-devel
- libxkbcommon-devel - libxkbcommon-devel
- desktop-file-utils - desktop-file-utils
Debian:
- name: Add extra dependencies for EL7
when:
- ansible_distribution_major_version == 7
ansible.builtin.set_fact:
alacritty_build_deps: "{{ alacritty_build_deps + ['xcb-util-devel', '@Development Tools'] }}"
- name: Add extra dependencies for EL8
when:
- ansible_distribution_major_version == 8
ansible.builtin.set_fact:
alacritty_build_deps: "{{ alacritty_build_deps + ['@Development Tools'] }}"
- name: Set options for Debian based Linux
when:
- ansible_os_family == 'Debian'
ansible.builtin.set_fact:
alacritty_build_deps:
- cmake - cmake
- g++ - g++
- pkg-config - pkg-config
@@ -87,26 +57,7 @@
- python3 - python3
- libfreetype6-dev - libfreetype6-dev
- desktop-file-utils - desktop-file-utils
Alpine:
- name: Set options for Archlinux
when:
- ansible_os_family == 'Archlinux'
ansible.builtin.set_fact:
alacritty_build_deps:
- cmake
- freetype2
- fontconfig
- pkg-config
- make
- libxcb
- libxkbcommon
- python
- desktop-file-utils
- name: Set options for Alpine based Linux
when: ansible_os_family == 'Alpine'
ansible.builtin.set_fact:
alacritty_build_deps:
- cmake - cmake
- pkgconf - pkgconf
- freetype-dev - freetype-dev
@@ -116,11 +67,17 @@
- g++ - g++
- libxkbcommon-dev - libxkbcommon-dev
- desktop-file-utils - desktop-file-utils
Archlinux:
- name: Set options for FreeBSD - cmake
when: ansible_os_family == 'FreeBSD' - freetype2
ansible.builtin.set_fact: - fontconfig
alacritty_build_deps: - pkg-config
- make
- libxcb
- libxkbcommon
- python
- desktop-file-utils
FreeBSD:
- cmake - cmake
- freetype2 - freetype2
- fontconfig - fontconfig
@@ -128,6 +85,24 @@
- python3 - python3
- desktop-file-utils - desktop-file-utils
- name: Set alacritty install extra build deps
when:
- alacritty_install_method == "source"
- ansible_os_family == "RedHat"
- ansible_os_major_version < 9
block:
- name: Add extra dependencies for EL7
when:
- ansible_distribution_major_version == 7
ansible.builtin.set_fact:
alacritty_build_deps_extra: ['xcb-util-devel', '@Development Tools']
- name: Add extra dependencies for EL8
when:
- ansible_distribution_major_version == 8
ansible.builtin.set_fact:
alacritty_build_deps_extra: ['@Development Tools']
- name: Complete alacritty configuration - name: Complete alacritty configuration
when: __alacritty_configured is undefined when: __alacritty_configured is undefined
ansible.builtin.set_fact: ansible.builtin.set_fact:
@@ -140,7 +115,7 @@
when: when:
- alacritty_method == 'source' - alacritty_method == 'source'
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + alacritty_build_deps + ['git'] }}" pkg_sys: "{{ pkg_sys + alacritty_build_deps + alacritty_build_deps_extra + ['git'] }}"
pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}" pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}"
- name: Append alacritty to pkg_cask - name: Append alacritty to pkg_cask

View File

@@ -1,5 +1,33 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Append ansible to pkg_sys - name: Set maintainer
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['ansible'] }}" ansible_maintainers:
- Matthew Stobbs
- name: Configure ansible
when:
- __ansible_configured is undefined or
not __ansible_configured
block:
- name: Set ansible install method
when:
- ansible_install_method is undefined
ansible.bulitin.set_fact:
ansible_install_method: "{% if install_method in ansible_install_methods %}{{ install_method }}{% else %}{{ ansible_install_methods[0] }}{% endif %}"
ansible_pkgname:
RedHat: ansible
Debian: ansible
Alpine: ansible
Archlinux: ansible
- name: Complete ansible configuration
ansible.builtin.set_fact:
__ansible_configured: true
- name: Append ansible to system package manager install list
when:
- ansible_install_method == 'system'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [ansible_pkgname[ansible_os_family]] }}"
- name: Append ansible to pipx install list

View File

@@ -1,58 +1,54 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Configure ansible-lint - name: Configure ansible_lint
when: when:
- __ansible_lint_configured is undefined or - __ansible_lint_configured is undefined or
not __ansible_lint_configured not __ansible_lint_configured
block: block:
- name: Set basic variables - name: Set basic variables
ansible.builtin.set_fact: ansible.builtin.set_fact:
ansible_lint_version: latest ansible_lint_version: "{{ ansible_lint_version | default('latest') }}"
- name: Configure package options - name: Set ansible_lint install method
ansible.builtin.set_fact:
ansible_lint_install_method: "{{ ansible_lint_install_method | default(install_method) }}"
- name: Set pipx name
when: when:
- ansible_lint_install_method == 'pipx' - ansible_lint_install_method is undefined
ansible.builtin.set_fact:
ansible_lint_install_method: "{% if install_method in ansible_lint_install_methods %}{{ install_method }}{% else %}{{ ansible_lint_install_methods[0] }}{% endif %}"
- name: Set pipx pkgnname
when:
- ansible_lint_install_method == 'pipx' or
ansible_lint_install_method == 'system_pip'
ansible.builtin.set_fact: ansible.builtin.set_fact:
ansible_lint_pkgname: "{{ 'ansible_lint' if ansible_lint_version == 'latest' else 'ansible-lint==' ~ ansible_lint_version }}" ansible_lint_pkgname: "{{ 'ansible_lint' if ansible_lint_version == 'latest' else 'ansible-lint==' ~ ansible_lint_version }}"
- name: Set package name - name: Set package name
when: when:
- install_method == 'system' - install_method == 'system'
block:
- name: Set package name RedHat/Debian/Alpine/Arch distros
when:
- ansible_os_family in ['RedHat', 'Debian', 'Alpine', 'Archlinux']
ansible.builtin.set_fact: ansible.builtin.set_fact:
ansible_lint_pkgname: ansible-lint ansible_lint_pkgname:
RedHat: ansible-lint
- name: Set package name for FreeBSD Debian: ansible-lint
when: Archlinux: ansible-lint
- ansible_os_family == 'FreeBSD' Alpine: ansible-lint
ansible.builtin.set_fact: FreeBSD: py311-ansible-lint
ansible_lint_pkgname: py311-ansible-lint
- name: Ensure ansible_lint_install_method is valid
when:
- ansible_lint_install_method not in ansible_lint_install_methods
ansible.builtin.set_fact:
ansible_lint_install_method: ansible_lint_install_methods[0]
- name: Complete ansible_lint configuration - name: Complete ansible_lint configuration
ansible.builtin.set_fact: ansible.builtin.set_fact:
__ansible_lint_configured: true __ansible_lint_configured: true
- name: Add ansible-lint to pipx install list - name: Add ansible_lint to pipx install list
when: when:
- ansible_lint_install_method == 'pipx' - ansible_lint_install_method == 'pipx'
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_pipx: "{{ pkg_pipx + [ansible_lint_pkgname] }}" pkg_pipx: "{{ pkg_pipx + [ansible_lint_pkgname] }}"
- name: Add ansible_lint to system_pip install list
when:
- ansible_lint_install_method == 'system_pip'
- name: Append ansible-lint to system install list - name: Append ansible-lint to system install list
when: when:
- ansible_lint_install_method == 'system' - ansible_lint_install_method == 'system'
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [ansible_lint_pkgname] }}" pkg_sys: "{{ pkg_sys + [ansible_lint_pkgname[ansible_os_family]] }}"

View File

@@ -1,16 +1,78 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Load go config - name: Configure go for install
ansible.builtin.include_tasks:
file: config/go.yml
- name: Append go to pkg_archive
when: when:
- go.method == 'archive' - __go_configured is undefined
block:
- name: Configure go install method
when:
- go_install_method is undefined
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_archive: "{{ pkg_archive + ['go'] }}" go_install_method: "{% if install_method in go_install_methods %}{{ install_method }}{% else %}{{ go_install_methods[0] }}{% endif %}"
- name: Append to pkg_sys - name: Configure go archive installation
- go.method != 'archive' when:
- go_install_method == 'archive'
block:
- name: Configure go
ansible.builtin.set_fact:
go_version: "{{ go_version | default('1.25.6') }}"
go_system: "{{ ansible_system | lower }}"
go_archmap:
arm64: arm64
aarch64: arm64
x86_64: amd64
go_install_sums:
1.25.6:
Darwin:
amd64: sha256:e2b5b237f5c262931b8e280ac4b8363f156e19bfad5270c099998932819670b7
arm64: sha256:984521ae978a5377c7d782fd2dd953291840d7d3d0bd95781a1f32f16d94a006
Linux:
amd64: sha256:f022b6aad78e362bcba9b0b94d09ad58c5a70c6ba3b7582905fababf5fe0181a
arm64: sha256:738ef87d79c34272424ccdf83302b7b0300b8b096ed443896089306117943dd5
- name: Set go architecture
ansible.builtin.set_fact:
go_arch: "{{ go_archmap[ansible_architecture] }}"
- name: Set archive name
ansible.builtin.set_fact:
go_archive: "go{{ go_version }}.{{ go_system }}-{{ go_arch }}.tar.gz"
- name: Set go download url
ansible.builtin.set_fact:
go_archive_url: "https://go.dev/dl/{{ go_archive }}"
- name: Set archive extract location
ansible.builtin.set_fact:
go_extract_path: "{{ path_archive }}/go{{ go_version }}"
- name: Complete go archive install configuration
ansible.builtin.set_fact:
__go_configured: true
go_archive_install:
extract_path: "{{ go_extract_path }}"
archive_url: "{{ go_archive_url }}"
archive_name: "{{ go_archive }}"
archive_checksum: "{{ go_install_sums[go_version][ansible_system][go_arch] }}"
- name: Install vis system package manager
when:
- go_install_method == 'system'
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['go'] }}" pkg_sys: "{{ pkg_sys + ['go'] }}"
- name: Install via archive
when:
- go_install_method == 'archive'
block:
- name: Add go archive extract install
ansible.builtin.set_fact:
pkg_archive: "{{ pkg_archive + [go_archive_install] }}"
- name: Set symbolic link to archive path
ansible.bulitin.file:
state: link
force: true
path: "{{ path_go }}"
src: "{{ got_extract_path }}/go"

View File

@@ -1,55 +1,51 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
# variables used in ansible_role_package # variables used in ansible_role_package
--- ---
default_flatpak_method: system # General configuration
default_flatpak_remotes: clean_install: false
- name: flathub clean_cache: false
install_become: true
install_become_user: root
install_method: system
install_prefix: /usr/local
install_prefix_mode: '0755'
install_prefix_owner: root
install_prefix_group: root
extra_ldd_paths: []
packages_extra: []
# flatpak default configuration
flathub_remote:
name: flathub
url: https://dl.flathub.org/repo/flathub.flatpakrepo url: https://dl.flathub.org/repo/flathub.flatpakrepo
default_flatpak_remote_name: flathub flatpak_default_remote: flathub
default_install_method: system flatpak_method: system
default_install_prefix: /usr/local flatpak_remotes: "{{ [flathub_remote] }}"
default_store_path: HOME/.cache/ansible_role_package
default_path_appimage: /usr/local/appimage
default_path_archive: /usr/local/archive
default_path_bin: /usr/local/bin
default_path_cargo: /usr/local/cargo
default_path_go: /usr/local/go
default_path_pipx: /usr/local/pipx
default_path_git: /usr/local/git
packages: [] # list of packages to install
extra_packages: [] # list of extra packages to add to pkg_sys
# Path suffixes for installation types. Prefixed by `default_install_prefix` # Installation paths
directory_appimage: appimage path_appimage: "{{ install_prefix }}/appimage"
directory_archive: archive path_archive: "{{ install_prefix }}/archive"
directory_bin: bin path_bin: "{{ install_prefix }}/bin"
directory_cargo: cargo path_cargo: "{{ install_prefix }}/cargo"
directory_go: go path_git: "{{ store_path }}/git"
directory_pipx: pipx path_go: "{{ install_prefix }}/go"
directory_git: git path_pipx: "{{ install_prefix }}/pipx"
store_path: "{{ ansible_user_dir }}/.cache/ansible_role_package"
default_clean_source: false # System paths
## Extra config that usually will not need to be changed # empty lists that must be defined
hyprgitbase: https://github.com/hyprwm pkg_archive: [] # packages installed via prebuilt archive
pkg_cargo: [] # rust packages from cargo using `cargo install`
_pkgconfig_force_rebuild: false pkg_cargo_build: [] # rust packages using `cargo build` before install
pkg_go: [] # go applications
# neovim configuration pkg_npm: [] # npm commands
_pkgversion_neovim: master pkg_pipx: [] # pipx packages
_gitbranch_neovim: master pkg_sys_pip: [] # system pip packages
pkg_src: [] # packages built from source
# Empty variables that need to exist pkg_sys: [] # system package manager packages
flatpak_remotes: null # flatpak remotes to add instead of default pkg_zig: [] # zig packages
flatpak_remote_name: null # the source of flatpak installations pkg_sh: [] # use shell commands to install a package
flatpak_method: null # the method to use when installing flatpak pkg_appimage: [] # appimages to install
install_method: null # the way to install packages (system, source, etc) pkg_flatpak: [] # flatpak packages to install
install_prefix: null # the path prefix to install files pkg_snap: [] # snpacraft.io packages
store_path: null # the path to store archives, git repos and appimages, etc.
path_appimage: null
path_archive: null
path_bin: null
path_cargo: null
path_go: null
path_pipx: null
use_become: true

6
vars/maintainers.yml Normal file
View File

@@ -0,0 +1,6 @@
# vim: set filetype=yaml.ansible :
---
maintainers:
- name: Matthew Stobbs
packages:
- all

View File

@@ -12,4 +12,11 @@ alacritty_install_methods:
- source - source
ansible_lint_install_methods: ansible_lint_install_methods:
- system - system
- system_pip
- pipx - pipx
ansible_install_methods:
- system
- system_pip
yazi_install_methods:
- source
- cargo