taktus.package
Package
This role helps manage software packages on different operating systems.
Currently, it works with apt, yum, dnf, brew, zypper, pacman, and portage. Feel free to suggest new package managers!
Note:
- This role takes care of name differences between package managers but not between different systems using the same package manager.
- Testing is not very extensive, so please report any bugs!
Requirements
- Hosts should be set up for Ansible (have Python, etc.)
- Must have root access, e.g.,
become: yes
Role Variables
Variable | Description | Default Value |
---|---|---|
package_list |
List of packages (see details!) | [] |
package_list_host |
List of packages (see details!) | [] |
package_list_group |
List of packages (see details!) | [] |
package_state |
Default package state | 'present' |
package_update_cache |
Update the cache? | yes |
package_cache_valid_time |
How long is the package cache valid? (in seconds) | 3600 |
package_list
Details
package_list
, package_list_host
, and package_list_group
are combined when managing packages. You can specify packages for each host or group.
The package list allows you to define which packages to manage. Each item can have the following attributes:
Variable | Description | Required |
---|---|---|
name |
Name of the package | yes |
state |
State of the package | no |
apt |
Name of the package for apt | no |
apt_ignore |
Ignore this package for apt | no |
apt_install_recommends |
Install recommended dependencies for apt? | no |
yum |
Name of the package for yum | no |
yum_ignore |
Ignore this package for yum | no |
dnf |
Name of the package for dnf | no |
dnf_ignore |
Ignore this package for dnf | no |
brew |
Name of the package for brew | no |
brew_ignore |
Ignore this package for brew | no |
zypper |
Name of the package for zypper | no |
zypper_ignore |
Ignore this package for zypper | no |
pacman |
Name of the package for pacman | no |
pacman_ignore |
Ignore this package for pacman | no |
portage |
Name of the package for portage | no |
portage_ignore |
Ignore this package for portage | no |
By default, package_state
and item.name
are used when managing packages. If item.state
is defined or a specific package name (like item.apt
), those will be used instead. If you want a package to be ignored for certain package managers, you can set ***_ignore
: yes.
package_list
Example
package_list:
- name: package
- name: package1
state: absent
- name: package2
apt: package2_apt_name
- name: package3
apt_ignore: yes
yum: package3_yum_name
pacman: package3_pacman_name
portage: package3_portage_name
Dependencies
None.
Example Playbook
---
- hosts: servers
roles:
- { role: GROG.package,
become: yes,
package_list: [
{ name: htop,
brew: htop-osx },
{ name: tree }
]
}
Contributing
All help, changes, or ideas are welcome!
Author
By G. Roggemans
License
MIT