# 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: 1. System package manager (dnf, apt, homebrew, etc.) 2. Source built - only in some situations, like for fast moving software (neovim, hyprland) - Includes language package managers like `go install`, `cargo install`, and `npm install` 3. Flatpak (Linux only) 4. Snap (Linux only) 5. 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, default `true` - When `true`, uses the following paths: - `$HOME/.local` as the install prefix, placing binaries in `$HOME/.local/bin` - `$HOME/.local/appimage` for saved appimages, which are then linked to `$HOME/.local/bin` - `$HOME/.local/archive` for extracted archives linking binaries to `$HOME/.local/bin` - `$HOME/.cache` for caching downloads - `$HOME/.cargo` for cargo installations, placing binaries in `$HOME/.cargo/bin` - When `false`, uses the following system wide paths: - `/usr/local` as the install prefix, placing binaries in `/usr/local/bin` - `/opt/appimage` for saved appimages, which are then linked to `/usr/local/bin` - `/opt/archive` for extracted archives, linking binaries to `/usr/local/bin` - `/opt/cache` for caching downloads - `/opt/cargo` for rust cargo installations, placing binaries in `/opt/cargo/bin` - `packages`: List of strings - List of packages to install from the `Available Packages` list - `prefer_method`: String, default `system` - The preferred method of installation an application when multiple options exist - Valid options are: - `flatpak` - Flatpak, Linux only - `langtool` - Using language tools such as `cargo`, `go`, `npm` or `pipx` - `snap` - Snap, Linux only - `source` - Prefer building from source. **Not recommended** - `system` - Default, system package manager (dnf, apt, homebrew, etc.) ## Dependencies ## Example Playbook ```yaml - 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