Files
ansible_role_package/tasks/facts.yml
2025-03-25 04:03:38 -06:00

78 lines
2.7 KiB
YAML

# vim: set filetype=yaml.ansible :
---
- name: Set local path prefix
when:
- use_local
ansible.builtin.set_fact:
path:
prefix: "{{ lookup('ansible.builtin.env', 'HOME') ~ '/.local' }}"
- name: Set non-local path prefix
when:
- not use_local
ansible.builtin.set_fact:
path:
prefix: "{{ defaults.path.prefix }}"
- name: Set install variables
ansible.builtin.set_fact:
ext_become: "{{ not use_local }}"
path:
prefix: "{{ path.prefix }}"
appimage: "{{ path.appimage | default(path.prefix ~ defaults.path.suffix.appimage) }}"
archive: "{{ path.archive | default(path.prefix ~ defaults.path.suffix.archive) }}"
bin: "{{ path.bin | default(path.prefix ~ defaults.path.suffix.bin) }}"
cargo: "{{ path.cargo | default(path.prefix ~ defaults.path.suffix.cargo) }}"
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 Linux specific facts
when:
- ansible_system == 'Linux'
ansible.builtin.set_fact:
flatpak_remote: # flatpak remotes, includes flathub by default
- name: flathub
url: https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak_method: "{% if use_local %}user{% else %}system{% endif %}"
pkg_appimage: [] # appimages to install
pkg_flatpak: [] # flatpak packages to install
pkg_snap: [] # snpacraft.io packages
pipx_exec: "/usr/bin/pipx"
sys_pkg_become: true # Linux package managers require sudo access
lib_path: lib64
- name: Set alpine linux specific facts
when:
- ansible_os_family == 'Alpine'
ansible.builtin.set_fact:
lib_path: lib
- name: Set rpm dist if RedHat based
when:
- ansible_os_family == 'RedHat'
changed_when: false
register: rpm_dist
ansible.builtin.command:
cmd: rpm --eval "%{dist}"
- name: Set macOS specific facts
when:
- ansible_distribution == 'MacOSX'
ansible.builtin.set_fact:
brewtap: [] # homebrew taps to add
pipx_exec: "/opt/homebrew/bin/pipx"
pkg_cask: [] # homebrew casks
pkg_tap: [] # homebrew tap packages
sys_pkg_become: false # homebrew doesn't require sudo access
lib_path: lib
- name: Set OS independant facts
ansible.builtin.set_fact:
pkg_archive: [] # packages installed via prebuilt archive
pkg_cargo: [] # rust packages from cargo
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