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
description:
- Make the installation of packages consistent on each platform.
- Installs for RedHat, Debian and MacOS based systems.
author:
- Matthew Stobbs <matthew@stobbs.ca>
- Will install via system package managers, source, or specific install tool. For example, a go package installed via source will run `go install`.
maintainers:
- Matthew Stobbs
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:
type: list
elements: str
@@ -16,80 +67,84 @@ argument_specs:
description:
- The list of packages to install by name.
- The list must contain only values that exist in B(Available Packages) in README.md
extra_packages:
packages_extra:
type: list
elements: str
required: false
default: []
description:
- 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:
type: str
required: false
default: system
description:
- Default installation method for flatpaks.
- Possible values are 'system' and 'user'
install_method:
type: str
default: system
choices:
- system
- source
- appimage
- flatpak
- snap
- Possible values are 'system' and 'user'.
- Only applies to linux distros.
flatpak_remotes:
type: list
elements: dict
required: false
default:
- name: flathub
url: https://dl.flathub.org/repo/flathub.flatpakrepo
description:
- Default installation method for packages.
- Varies between each indivdual package, but this is for overall package installation.
- Possible values are V(system), V(source), V(appimage), V(flatpak), V(snap)
- 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:
- List of flatpak remotes to add to the system.
- Does not remove pre existing flatpak repos.
clean_install:
type: bool
default: false
description:
- Remove existing installation of package before installing
- Remove existing installation of package before installing.
path_appimage:
type: path
default: INSTALL_PREFIX/appimage
default: /usr/local/appimage
description:
- Where appimage files are stored.
path_archive:
type: path
default: INSTALL_PREFIX/archive
default: /usr/local/archive
description:
- Where archives are extracted.
path_bin:
type: path
default: INSTALL_PREFIX/bin
default: /usr/local/bin
description:
- 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:
type: path
default: INSTALL_PREFIX/cargo
default: /usr/local/cargo
description:
- Where cargo installs it's packages
path_go:
type: path
default: INSTALL_PREFIX/go
default: /usr/local/go
description:
- Where go is installed. Equivalent of GOROOT.
path_pipx:
type: path
default: INSTALL_PREFIX/pipx
default: /usr/local/pipx
description:
- Where pipx installs it's virtual environments
use_become:
type: bool
default: true
store_path:
type: path
default: /<ansible_user_dir>/.cache/ansible_role_package
required: false
description:
- Elevate privileges when installing non-system packages.
- Building will be done as the ansible user, elevating only when installing.
- Where cached files are kept, such as git repositories.
- 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
when:
- ansible_system == 'Linux'
- ansible_system == 'Linux' or
ansible_os_family == 'FreeBSD'
ansible.builtin.set_fact:
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
when:
- ansible_system == 'Linux'
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"
path_lib: lib64
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 :
---
# 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
ansible.builtin.include_tasks:
file: facts.yml
- name: Ensure directory exists {{ path.prefix }}
become: "{{ ext_become }}"
- name: Create cache directory
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:
state: directory
mode: '0755'
path: "{{ path.prefix }}"
owner: "{{ install_prefix_owner }}"
group: "{{ install_prefix_group }}"
path: "{{ path }}"
- name: Ensure directory exists {{ path.bin }}
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.bin }}"
- name: Read default package configuration
- name: Read package configuration
ansible.builtin.include_vars:
dir: pkgs
extensions:
- yml
name: pkgconfig
file: pkglist.yml
- name: Read default package configuration
ansible.builtin.include_vars:
dir: src
extensions:
- yml
name: srcconfig
- name: Append system_packages to pkg_sys
- name: Add needed packages for Fedora
when:
- ansible_distribution == 'Fedora'
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
loop: "{{ packages | unique }}"
loop_control:
loop_var: pkg
ansible.builtin.include_tasks:
file: addpkg.yml
file: "pkgs/{{ pkg }}.yml"
- name: Flush handlers to ensure dependencies are installed
ansible.builtin.meta: flush_handlers
- name: Add needed packages for Fedora
- name: Install go if required
when:
- ansible_distribution == 'Fedora'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['python3-paramiko'] }}"
- pkg_go|length > 0
ansible.builtin.include_tasks:
file: pkgs/go.yml
- name: Add needed MacOS packages
- name: Install rust and cargo if required
when:
- ansible_distribution == 'MacOSX'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ['gnu-tar', 'virtualenv'] }}"
- pkg_cargo|length > 0 or
pkg_cargo_build|length > 0
ansible.builtin.include_tasks:
file: pkgs/rust.yml
- name: Add needed Alpine packages
- name: Ensure pipx is installed
when:
- ansible_os_family == 'Alpine'
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:
file: addpkg.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
- pkg_pipx|length > 0
ansible.builtin.include_tasks:
file: pkgs/pipx.yml
- name: Ensure pipx path exists
when: pkg_pipx|length > 0
@@ -141,12 +120,14 @@
path: "{{ path.appimage }}"
- name: Ensure archive path exists
when: pkg_archive|length > 0
become: "{{ ext_become }}"
when:
- pkg_archive|length > 0
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.archive }}"
path: "{{ path_archive }}"
- name: Depend zig
when: pkg_zig|length > 0

View File

@@ -1,36 +1,29 @@
# vim: set filetype=yaml.ansible :
---
- name: Set air configuration
- name: Set air configuration # {{{
when:
- __air_configured is undefined or
not __air_configured
block:
- name: Set air_install_method
- name: Set air install method
when:
- air_install_method is undefined
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
ansible.builtin.set_fact:
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:
air_pkg: "{{ air_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]
air_pkg: "{{ air_install_url }}@{{ air_version }}"
- name: Complete air configuration
ansible.builtin.set_fact:
__air_configured: true
# }}}
- name: Append air to pkg_go
when:
- air_install_method == 'source'

View File

@@ -5,128 +5,103 @@
- __alacritty_configured is undefined or
not __alacritty_configured
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
ansible.builtin.set_fact:
alacritty_version: v0.16.1
alacritty_git_repo: https://github.com/alacritty/alacritty
alacritty_pkgname: alacritty
alacritty_version: "{{ alacritty_version | default('v0.16.1') }}"
alacritty_git_repo: "{{ alacritty_git_repo | default('https://github.com/alacritty/alacritty') }}"
alacritty_pkgname: "{{ alacritty_pkgname | default('alacritty') }}"
alacritty_build_deps_extra: []
- name: Set install type
- name: Configure alacritty source install
when:
- alacritty_install_method is undefined or
alacritty_install_method == ''
- alacritty_install_method == "source"
ansible.builtin.set_fact:
alacritty_install_method: system
alacritty_src_install:
cargo_build_flags:
- --release
name: "{{ alacritty_pkgname }}"
repo: "{{ alacritty_git_repo }}"
version: "{{ alacritty_version }}"
bin_output: "target/release/alacritty"
bin_name: "alacritty"
install_prefix: "{{ install_prefix }}"
install_files:
extra/logo/alacritty-term.svg: share/pixmaps/Alacritty.svg
desktop_files:
- extra/linux/Alacritty.desktop
files_list:
- bin/alacritty
- share/pixmaps/Alacritty.svg
alacritty_build_deps:
RedHat:
- cmake
- fontconfig-devel
- freetype-devel
- g++
- libxcb-devel
- libxkbcommon-devel
- desktop-file-utils
Debian:
- cmake
- g++
- pkg-config
- libfontconfig1-dev
- libxcb-xfixes0-dev
- libxkbcommon-dev
- python3
- libfreetype6-dev
- desktop-file-utils
Alpine:
- cmake
- pkgconf
- freetype-dev
- fontconfig-dev
- python3
- libxcb-dev
- g++
- libxkbcommon-dev
- desktop-file-utils
Archlinux:
- cmake
- freetype2
- fontconfig
- pkg-config
- make
- libxcb
- libxkbcommon
- python
- desktop-file-utils
FreeBSD:
- cmake
- freetype2
- fontconfig
- pkgconf
- python3
- desktop-file-utils
- name: Install via source
when:
- alacritty_install_method is defined
- alacritty_install_method == 'source' or
install_method == 'source'
block:
- name: Configure alacritty source install
ansible.builtin.set_fact:
alacritty_install_method: source
alacritty_src_install:
cargo_build_flags:
- --release
name: "{{ alacritty_pkgname }}"
repo: "{{ alacritty_git_repo }}"
version: "{{ alacritty_version }}"
bin_output: "target/release/alacritty"
bin_name: "alacritty"
install_prefix: "{{ install_prefix }}"
install_files:
extra/logo/alacritty-term.svg: share/pixmaps/Alacritty.svg
desktop_files:
- extra/linux/Alacritty.desktop
files_list:
- bin/alacritty
- share/pixmaps/Alacritty.svg
- name: Set alacritty install options
- name: Set alacritty install extra build deps
when:
- alacritty_install_method == "source"
- ansible_os_family == "RedHat"
- ansible_os_major_version < 9
block:
- name: Set options for RedHat based Linux
- name: Add extra dependencies for EL7
when:
- ansible_os_family == 'RedHat'
block:
- name: Set common build dependencies
ansible.builtin.set_fact:
alacritty_build_deps:
- cmake
- fontconfig-devel
- freetype-devel
- g++
- libxcb-devel
- libxkbcommon-devel
- desktop-file-utils
- ansible_distribution_major_version == 7
ansible.builtin.set_fact:
alacritty_build_deps_extra: ['xcb-util-devel', '@Development Tools']
- 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
- name: Add extra dependencies for EL8
when:
- ansible_os_family == 'Debian'
- ansible_distribution_major_version == 8
ansible.builtin.set_fact:
alacritty_build_deps:
- cmake
- g++
- pkg-config
- libfontconfig1-dev
- libxcb-xfixes0-dev
- libxkbcommon-dev
- python3
- libfreetype6-dev
- desktop-file-utils
- 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
- pkgconf
- freetype-dev
- fontconfig-dev
- python3
- libxcb-dev
- g++
- libxkbcommon-dev
- desktop-file-utils
- name: Set options for FreeBSD
when: ansible_os_family == 'FreeBSD'
ansible.builtin.set_fact:
alacritty_build_deps:
- cmake
- freetype2
- fontconfig
- pkgconf
- python3
- desktop-file-utils
alacritty_build_deps_extra: ['@Development Tools']
- name: Complete alacritty configuration
when: __alacritty_configured is undefined
@@ -140,7 +115,7 @@
when:
- alacritty_method == 'source'
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] }}"
- name: Append alacritty to pkg_cask

View File

@@ -1,5 +1,33 @@
# vim: set filetype=yaml.ansible :
---
- name: Append ansible to pkg_sys
- name: Set maintainer
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 :
---
- name: Configure ansible-lint
- name: Configure ansible_lint
when:
- __ansible_lint_configured is undefined or
not __ansible_lint_configured
block:
- name: Set basic variables
ansible.builtin.set_fact:
ansible_lint_version: latest
ansible_lint_version: "{{ ansible_lint_version | default('latest') }}"
- name: Configure package options
ansible.builtin.set_fact:
ansible_lint_install_method: "{{ ansible_lint_install_method | default(install_method) }}"
- name: Set pipx name
- name: Set ansible_lint install method
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_lint_pkgname: "{{ 'ansible_lint' if ansible_lint_version == 'latest' else 'ansible-lint==' ~ ansible_lint_version }}"
- name: Set package name
when:
- 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_lint_pkgname: ansible-lint
- name: Set package name for FreeBSD
when:
- ansible_os_family == 'FreeBSD'
ansible.builtin.set_fact:
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]
ansible_lint_pkgname:
RedHat: ansible-lint
Debian: ansible-lint
Archlinux: ansible-lint
Alpine: ansible-lint
FreeBSD: py311-ansible-lint
- name: Complete ansible_lint configuration
ansible.builtin.set_fact:
__ansible_lint_configured: true
- name: Add ansible-lint to pipx install list
- name: Add ansible_lint to pipx install list
when:
- ansible_lint_install_method == 'pipx'
ansible.builtin.set_fact:
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
when:
- ansible_lint_install_method == 'system'
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 :
---
- name: Load go config
ansible.builtin.include_tasks:
file: config/go.yml
- name: Append go to pkg_archive
- name: Configure go for install
when:
- go.method == 'archive'
ansible.builtin.set_fact:
pkg_archive: "{{ pkg_archive + ['go'] }}"
- __go_configured is undefined
block:
- name: Configure go install method
when:
- go_install_method is undefined
ansible.builtin.set_fact:
go_install_method: "{% if install_method in go_install_methods %}{{ install_method }}{% else %}{{ go_install_methods[0] }}{% endif %}"
- name: Append to pkg_sys
- go.method != 'archive'
- name: Configure go archive installation
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:
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 :
# variables used in ansible_role_package
---
default_flatpak_method: system
default_flatpak_remotes:
- name: flathub
url: https://dl.flathub.org/repo/flathub.flatpakrepo
default_flatpak_remote_name: flathub
default_install_method: system
default_install_prefix: /usr/local
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
# General configuration
clean_install: false
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: []
# Path suffixes for installation types. Prefixed by `default_install_prefix`
directory_appimage: appimage
directory_archive: archive
directory_bin: bin
directory_cargo: cargo
directory_go: go
directory_pipx: pipx
directory_git: git
# flatpak default configuration
flathub_remote:
name: flathub
url: https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak_default_remote: flathub
flatpak_method: system
flatpak_remotes: "{{ [flathub_remote] }}"
default_clean_source: false
# Installation paths
path_appimage: "{{ install_prefix }}/appimage"
path_archive: "{{ install_prefix }}/archive"
path_bin: "{{ install_prefix }}/bin"
path_cargo: "{{ install_prefix }}/cargo"
path_git: "{{ store_path }}/git"
path_go: "{{ install_prefix }}/go"
path_pipx: "{{ install_prefix }}/pipx"
store_path: "{{ ansible_user_dir }}/.cache/ansible_role_package"
## Extra config that usually will not need to be changed
hyprgitbase: https://github.com/hyprwm
# System paths
_pkgconfig_force_rebuild: false
# neovim configuration
_pkgversion_neovim: master
_gitbranch_neovim: master
# Empty variables that need to exist
flatpak_remotes: null # flatpak remotes to add instead of default
flatpak_remote_name: null # the source of flatpak installations
flatpak_method: null # the method to use when installing flatpak
install_method: null # the way to install packages (system, source, etc)
install_prefix: null # the path prefix to install files
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
# empty lists that must be defined
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_sys_pip: [] # system pip packages
pkg_src: [] # packages built from source
pkg_sys: [] # system package manager packages
pkg_zig: [] # zig packages
pkg_sh: [] # use shell commands to install a package
pkg_appimage: [] # appimages to install
pkg_flatpak: [] # flatpak packages to install
pkg_snap: [] # snpacraft.io packages

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
ansible_lint_install_methods:
- system
- system_pip
- pipx
ansible_install_methods:
- system
- system_pip
yazi_install_methods:
- source
- cargo