almaops.pkg_install
almaops.pkg_install
This role installs a list of software packages.
Description
This role was created for two main reasons. First, the built-in package module in Ansible doesn’t let you set how long the cache is valid for, since some package managers (like yum and dnf) update their repository information automatically, even when it's not needed. Second, wrapping this functionality in a role allows you to use it as a dependency in other roles.
Role Variables
pkg_install_packages
: This is a list of packages you want to install.
pkg_install_state
: This indicates the state of the package. It can be present
(default), latest
, or absent
.
pkg_install_update_cache
: This is set to true
by default, which means the repository metadata will be updated.
pkg_install_cache_valid_time
: This sets how often you want to update the repository (default is 600
seconds).
Example
- hosts: all
become: true
roles:
- role: almaops.pkg_install
pkg_install_packages:
- tmux
- screen
Install
You can install this role from Ansible Galaxy:
ansible-galaxy install almaops.pkg_install
License
Author Information
This role was created by Dmitrii Kashin, known as freehck.