Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.
/ ansible.apt Public archive

Configures apt on Debian and Ubuntu systems

License

Notifications You must be signed in to change notification settings

arillso/ansible.apt

Repository files navigation

Ansible Role: apt

Important Update

Please note that the ansible.users role has been moved to a new collection and will no longer be actively developed in this repository. For the latest version of the role, including new features and updates, please visit the new collection at https://github.com/arillso/ansible.system/tree/main/roles/apt_configuration. We encourage all users to switch to the updated role in the new collection for ongoing support and improvements.

Description

This role optimizes the package manager apt and under Debian/Ubuntu. It can be determined how long the packages will be cached, how often he should check for updates and when he should install the updates automatically.

Installation

ansible-galaxy install arillso.apt

Requirements

Role Variables

Archives

Whether the cache of DEB files should be preserved or cleaned

apt_preserve_cache: 'no'

Max age (in days) of DEB files to keep when cleaning cache

apt_archives_maxage: null

Min age (in days) of DEB files to keep when cleaning cache

apt_archives_minage: null

Max size (in MB) of DEB files to keep when cleaning cache

apt_archives_maxsize: null

General

whether or not suggested packages should be installed

apt_install_suggests: 'no'

do not install Recommended packages by default

apt_install_recommends: 'no'

allow 'apt-get autoremove' to remove recommended packages

apt_remove_recommends: 'no'

Enable the update/upgrade script

apt_periodic: 'yes'

Do “apt-get update” automatically every n-days (0=disable)

apt_update_package_lists: 1

Do “apt-get upgrade –download-only” every n-days (0=disable)

apt_download_upgradeable_packages: 0

Do “apt-get autoclean” every n-days (0=disable)

apt_auto_clean_interval: 0

unattended-upgrades

enable unattended-upgrades

apt_unattended_upgrades: 'yes'

list of packages to not update (regexp are supported)

apt_unattended_upgrades_blacklist: []

Split the upgrade into the smallest possible chunks so that they can be interrupted with SIGUSR1. This makes the upgrade a bit slower but it has the benefit that shutdown while a upgrade is running is possible (with a small delay)

apt_unattended_upgrades_minimal_steps: 'no'

Send email to this address for problems or packages upgrades If empty or unset then no email is sent, make sure that you have a working mail setup on your system. A package that provides 'mailx' must be installed. E.g. "user@example.com"

apt_mails: []

Set this value to "true" to get emails only on errors. Default is to always send a mail if Unattended-Upgrade::Mail is set

apt_unattended_upgrades_notify_error_only: 'yes'

Do automatic removal of new unused dependencies after the upgrade (equivalent to apt-get autoremove)

apt_unattended_upgrades_autoremove: 'yes'

Automatically reboot WITHOUT CONFIRMATION if the file /var/run/reboot-required is found after the upgrade

apt_unattended_upgrades_automatic_reboot: 'no'

If automatic reboot is enabled and needed, reboot at the specific time instead of immediately Values: now | 02:00 | ...

apt_unattended_upgrades_automatic_reboot_time: now

Dependencies

Example Playbook

- hosts: all
  roles:
    - arillso.apt

Author

Inspiration

License

This project is under the MIT License. See the LICENSE file for the full license text.

Copyright

(c) 2019, Arillso