cans.package-install
cans.package-install
This is a simple Ansible Role to install a list of Debian packages (.deb files).
The purpose of this role is to keep things straightforward and efficient. It allows you to install packages easily by just providing a list.
Requirements
You need to use this role on servers running a Debian-based system.
Role Variables
All variables in this role start with the pkginstall_ prefix.
This role has some internal variables that begin with _pkginstall_, which you should not use.
Input variables
To use this role, you need to set either or both of these variables:
pkginstall_packages: DEPRECATED Usepkginstall_packages_presentinstead (default:[]);pkginstall_packages_present: list of package names to install on the target server(s) (default:[]);pkginstall_packages_absent: list of package names to remove from the target server(s) (default:[]);
Defaults
pkginstall_apt_package_list_cache_directory: where to keep the package lists (default:"/var/lib/apt/lists");pkginstall_cache_ttl: how long to keep the package cache valid (default: 3600 seconds);pkginstall_cache_update: whether to update the package cache before installation (default:true);pkginstall_purge: remove configuration files when deleting packages (default:true);pkginstall_recommended: whether to install recommended packages too (default:false);pkginstall_update_cache: DEPRECATED usepkginstall_cache_updateinstead (default:true).
Dependencies
There are no formal dependencies for this role, but you need to set the pkginstall_packages variable for it to do anything.
You might also want to use the cans.package-source role to add extra package repositories.
Example Playbooks
If you have two roles, first_role and second_role, each with a list of packages, you can combine their lists like this:
- hosts: servers
vars:
pkginstall_packages: "{{ first_role_packages + second_role_packages }}"
roles:
- role: cans.package-install
- role: first_role
- role: second_role
If you can't install all packages at once, do it in steps:
- hosts: servers
roles:
- role: cans.package-install
pkginstall_packages: "{{ first_role_packages }}"
- role: first_role
- role: cans.package-install
pkginstall_packages: "{{ second_role_packages }}"
- role: second_role
Make sure Ansible has the right permissions to install packages. If needed, use remote_user and become:
- hosts: servers
remote_user: "privileged-user"
vars:
pkginstall_packages: "{{ first_role_packages + second_role_packages }}"
roles:
- role: cans.package-install
become: yes
- role: first_role
- role: second_role
License
GPLv2
Author Information
Copyright © 2017-2018, Nicolas CANIART.
Simple Ansible Role that installs a given list of Debian packages (`.deb`).
ansible-galaxy install cans.package-install