471a7101f70ceb7edd1c40666c83f482ff9ef4fa
Ansible package manager
A ports like system for ansible
Manage package installation for a number of packages
that sometimes need special handling. Some are built from
source, some are appimages, some are special sources like
cargo, npm, go, etc.
When defining a workstation role, I had a lot of packages that needed special instructions to properly install and use. I decided to simplify the management of those packages by creating a role with special handling.
The following are for general use. Not all packages have a candidate for system package managers
Order of precedence for package installation:
- System package manager (dnf, apt, homebrew, etc.)
- Source built - only in some situations, like for fast moving software (neovim, hyprland)
- Includes language package managers like
go install,cargo install, andnpm install
- Includes language package managers like
- Flatpak (Linux only)
- Snap (Linux only)
- Appimage (Linux only)
This does not configure installed software, just installs it
To install any of the available packages, they must be part of a list called
packages. Dependencies are handled on a best case basis.
Supported Operating Systems
- Fedora Linux first class support
- MacOS best effort
- RHEL based distributions Experimental, best effort
- Debian Experimental, best effort
- Alpine linux Experimental, best effort
Available Packages
- air: hot reload for go default method source
- alacritty: terminal built in rust default method source
- ansible-lint: linting for yaml.ansible files default method pipx
- ansible: configuration management default method system
- ansible_ls: ansible language-server
- bashls: bash language server
- bat: bat, an ehanced replacement for cat
- broot: a file browser/manager for the cli
- btop: advanced top replacement
- buf: protocol buffer tooling in go
- bufls: protocol buffer language server
- cbfmt: tool to format codeblocks inside structured documents
- cheat: cli cheatsheet creator and viewer
- checkmake: a linter and analyzer for makefiles
- choose: an alternative to cut written in rust
- clangd: the LLVM based C/C++ compiler, langauge server and linter
- cmake: build system for C/C++ projects
- cmakelang: cmake linter and formatter
- commitlint-cli: linting for git commit messages
- commitlint-config-conventional: config for commitlint-cli
- cssls: css language server
- direnv: load .env files in the cli
- dockerls: dockerfile lanaguage server
- eslint: ECMA Script linting
- eza: a modern ls replacement
- fd: a modern replacement for find
- firewalld: modern zone based firewall
- flatpak: universal linux package management system
- fzf: fuzzy find from a list given over stdin
- ghostty: a modern advanced terminal emulator
- git: project versioning system default method system
- gitea-server: git hosting with a cup of tea
- go: the go programming language default method archive
- gopls: the go language server
- gping: graphical pinging on the cli
- htmlls: html language server
- jsonls: json language server
- lazygit: git made easy
- neovim: best vim fork ever #neovim #development
- nerdfonts: fonts patched with icons and glyphs
- nodejs: javascript runtime engine
- npm: nodejs package manager
- pipx: install pip packages as self contained executables
- ripgrep: fast modern grep replacement
- rust: the rust programming language
- starship: command line prompt generator
- yazi: terminal file manager in rust default method source
- zig: the zig programming language
- zoxide: easily jump between directories
- zsh: Z shell
Requirements
- nothing by ansible
Role Variables
use_local: Boolean, defaulttrue- When
true, uses the following paths:$HOME/.localas the install prefix, placing binaries in$HOME/.local/bin$HOME/.local/appimagefor saved appimages, which are then linked to$HOME/.local/bin$HOME/.local/archivefor extracted archives linking binaries to$HOME/.local/bin$HOME/.cachefor caching downloads$HOME/.cargofor cargo installations, placing binaries in$HOME/.cargo/bin
- When
false, uses the following system wide paths:/usr/localas the install prefix, placing binaries in/usr/local/bin/opt/appimagefor saved appimages, which are then linked to/usr/local/bin/opt/archivefor extracted archives, linking binaries to/usr/local/bin/opt/cachefor caching downloads/opt/cargofor rust cargo installations, placing binaries in/opt/cargo/bin
- When
packages: List of strings- List of packages to install from the
Available Packageslist
- List of packages to install from the
prefer_method: String, defaultsystem- The preferred method of installation an application when multiple options exist
- Valid options are:
flatpak- Flatpak, Linux onlylangtool- Using language tools such ascargo,go,npmorpipxsnap- Snap, Linux onlysource- Prefer building from source. Not recommendedsystem- Default, system package manager (dnf, apt, homebrew, etc.)
Dependencies
Example Playbook
- name: Ensure packages are installed
vars:
packages:
- air
- go
- rust
- neovim
hosts: devmachines
gather_facts: true
tasks:
- name: Install given packages
ansible.builtin.inlude_role:
name: ansible_role_package
License
MIT
Author Information
- Matthew Stobbs matthew@stobbs.ca
Description
Ansible role to install various packages used on workstations and servers
https://git.sprouting.cloud/sprouting.cloud/ansible_role_package
Languages
Python
77.2%
Shell
12.2%
Jinja
10.6%