should have all the variables needed

This commit is contained in:
Matthew Stobbs
2026-01-25 01:38:28 -07:00
parent 7b8eaf35b7
commit fc0f6e6a82
5 changed files with 120 additions and 66 deletions

View File

@@ -21,13 +21,13 @@ argument_specs:
elements: str elements: str
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
default_flatpak_method: flatpak_method:
type: str type: str
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'
default_install_method: install_method:
type: str type: str
default: system default: system
choices: choices:
@@ -41,18 +41,55 @@ argument_specs:
- Default installation method for packages. - Default installation method for packages.
- Varies between each indivdual package, but this is for overall package installation. - Varies between each indivdual package, but this is for overall package installation.
- Possible values are V(system), V(source), V(appimage), V(flatpak), V(cask), V(snap) - Possible values are V(system), V(source), V(appimage), V(flatpak), V(cask), V(snap)
default_install_prefix: install_prefix:
type: path type: path
default: /usr/local default: /usr/local
description: description:
- Default installation prefix when installation non-system packages. - Default installation prefix when installation non-system packages.
path_suffix_appimage: store_path:
type: path type: path
default: "{{ default_install_prefix }}/appimage" default: ANSIBLE_USER_DIR/.cache/ansible_role_package
description:
- Where to store cached files like archives and git repos
clean_source:
type: bool
default: false
description:
- Remove existing installation of package before installing
path_appimage:
type: path
default: INSTALL_PREFIX/appimage
description: description:
- Where appimage files are stored. - Where appimage files are stored.
path_suffix_archive: path_archive:
type: path type: path
default: "{{ default_install_prefix }}/archive" default: INSTALL_PREFIX/archive
description: description:
- Where archives are downloaded and extracted. - Where archives are extracted.
path_bin:
type: path
default: INSTALL_PREFIX/bin
description:
- Where binaries are installed or linked.
- Needs to be added to your PATH
path_cargo:
type: path
default: INSTALL_PREFIX/cargo
description:
- Where cargo installs it's packages
path_go:
type: path
default: INSTALL_PREFIX/go
description:
- Where go is installed. Equivalent of GOROOT.
path_pipx:
type: path
default: INSTALL_PREFIX/pipx
description:
- Where pipx installs it's virtual environments
use_become:
type: bool
default: true
description:
- Elevate privileges when installing non-system packages.
- Building will be done as the ansible user, elevating only when installing.

View File

@@ -12,12 +12,10 @@ galaxy_info:
platforms: platforms:
- name: Fedora - name: Fedora
versions: versions:
- all - "41+"
- "40"
- "41"
- name: EL - name: EL
versions: versions:
- "9" - "9+"
- name: macOS - name: macOS
version: version:
- ">=14.2" - ">=14.2"

View File

@@ -12,54 +12,58 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
package_home_base: /home package_home_base: /home
- name: Set local path prefix - name: Set defaults paths
when:
- use_local
ansible.builtin.set_fact: ansible.builtin.set_fact:
path: install_prefix: "{{ install_prefix | default(default_install_prefix) }}"
prefix: "{{ package_home_base }}/{{ ansible_ssh_user }}/.local" default_store_path: "{{ ansible_user_dir }}/.cache/ansible_role_package"
default_path_appimage: "{{ install_prefix | default(default_install_prefix) }}/appimage"
- name: Set non-local path prefix default_path_archive: "{{ install_prefix | default(default_install_prefix) }}/archive"
when: default_path_bin: "{{ install_prefix | default(default_install_prefix) }}/bin"
- not use_local default_path_cargo: "{{ install_prefix | default(default_install_prefix) }}/cargo"
ansible.builtin.set_fact: default_path_go: "{{ install_prefix | default(default_install_prefix) }}/go"
path: default_path_pipx: "{{ install_prefix | default(default_install_prefix) }}/pipx"
prefix: "{{ default_install_prefix }}"
- name: Set install variables - name: Set install variables
ansible.builtin.set_fact: ansible.builtin.set_fact:
ext_become: "{{ not use_local }}" store_path: "{{ store_path | default(default_store_path) }}"
path: path_appimage: "{{ path_appimage | default(default_path_appimage) }}"
prefix: "{{ default_install_prefix }}" path_archive: "{{ path_archive | default(default_path_archive) }}"
appimage: "{{ path.appimage | default(path.prefix ~ defaults.path.suffix.appimage) }}" path_bin: "{{ path_bin | default(default_path_bin) }}"
archive: "{{ path.archive | default(path.prefix ~ defaults.path.suffix.archive) }}" path_cargo: "{{ path_cargo | default(default_path_cargo) }}"
bin: "{{ path.bin | default(path.prefix ~ defaults.path.suffix.bin) }}" path_go: "{{ path_go | default(default_path_go) }}"
cargo: "{{ path.cargo | default(path.prefix ~ defaults.path.suffix.cargo) }}" path_pipx: "{{ path_pipx | default(default_path_pipx) }}"
go: "{% if ansible_distribution == 'MacOSX' %}/usr/local/go{% else %}{{ path.go | default(path.prefix ~ defaults.path.suffix.go) }}{% endif %}"
pipx: "{{ path.pipx | default(path.prefix ~ defaults.path.suffix.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_remote: # flatpak remotes, includes flathub by default flatpak_remotes: "{{ default_flatpak_remotes }}"
- name: flathub
url: https://dl.flathub.org/repo/flathub.flatpakrepo
pkg_appimage: [] # appimages to install pkg_appimage: [] # appimages to install
pkg_flatpak: [] # flatpak packages to install pkg_flatpak: [] # flatpak packages to install
pkg_snap: [] # snpacraft.io packages pkg_snap: [] # snpacraft.io packages
pipx_exec: "/usr/bin/pipx" pipx_exec: "/usr/bin/pipx"
sys_pkg_become: true # Linux package managers require sudo access path_lib: lib64
lib_path: lib64
root_prefix: /usr/local root_prefix: /usr/local
- name: Set alpine linux specific facts - name: Set alpine linux specific facts
when: when:
- ansible_os_family == 'Alpine' - ansible_os_family == 'Alpine'
ansible.builtin.set_fact: ansible.builtin.set_fact:
lib_path: lib path_lib: lib
- name: Set rpm dist if RedHat based - name: Set dist code if RedHat based
when: when:
- ansible_os_family == 'RedHat' - ansible_os_family == 'RedHat'
changed_when: false changed_when: false
@@ -76,17 +80,4 @@
pipx_exec: "/opt/homebrew/bin/pipx" # pipx executable pipx_exec: "/opt/homebrew/bin/pipx" # pipx executable
pkg_cask: [] # homebrew casks pkg_cask: [] # homebrew casks
pkg_tap: [] # homebrew tap packages pkg_tap: [] # homebrew tap packages
sys_pkg_become: false # homebrew doesn't require sudo access path_lib: lib # macos shared library path
lib_path: lib # macos shared library path
- 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_zig: [] # zig packages
pkg_src: [] # packages built from source
pkg_sys: [] # system package manager packages, homebrew on macOS, dnf for RedHat based, apt for Debian Based

View File

@@ -2,12 +2,14 @@
--- ---
# create all the facts used throughout the role, but shouldn't be touched # create all the facts used throughout the role, but shouldn't be touched
# by the user # by the user
- name: Create temporary directory for downloads - name: Create cache directory
register: d_tempdir register: d_cache
ansible.builtin.file: ansible.builtin.file:
path: /tmp/ansible_role_package path: "{{ store_path }}"
state: directory
mode: '0777' 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:

View File

@@ -2,20 +2,31 @@
# variables used in ansible_role_package # variables used in ansible_role_package
--- ---
default_flatpak_method: system 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_method: system
default_install_prefix: /usr/local default_install_prefix: /usr/local
debug: false 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 packages: [] # list of packages to install
extra_packages: [] # list of extra packages to add to pkg_sys extra_packages: [] # list of extra packages to add to pkg_sys
# Path suffixes for installation types. Prefixed by `default_install_prefix` # Path suffixes for installation types. Prefixed by `default_install_prefix`
path_suffix_appimage: appimage directory_appimage: appimage
path_suffix_archive: archive directory_archive: archive
path_suffix_bin: bin directory_bin: bin
path_suffix_cargo: cargo directory_cargo: cargo
path_suffix_go: go directory_go: go
path_suffix_pipx: pipx directory_pipx: pipx
path_suffix_source: source directory_git: git
default_clean_source: false default_clean_source: false
@@ -27,3 +38,18 @@ _pkgconfig_force_rebuild: false
# neovim configuration # neovim configuration
_pkgversion_neovim: master _pkgversion_neovim: master
_gitbranch_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