Skip to content
This repository has been archived by the owner on Jun 25, 2023. It is now read-only.

Commit

Permalink
Add support for Remove-New-Unused-Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
raspla authored and jnv committed Nov 4, 2020
1 parent 392df31 commit 9960a79
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ On some hosts you may find that the unattended-upgrade's cronfile `/etc/cron.dai
* Default: `false` (don't send any e-mail)
* `unattended_mail_only_on_error`: send e-mail only on errors, otherwise e-mail will be sent every time there's a package upgrade.
* Default: `false`
* `unattended_remove_unused_dependencies`: do automatic removal of new unused dependencies after the upgrade.
* `unattended_remove_unused_dependencies`: do automatic removal of all unused dependencies after the upgrade.
* Default: `false`
* `unattended_remove_new_unused_dependencies`: do automatic removal of new unused dependencies after the upgrade.
* Default: `true`
* `unattended_automatic_reboot`: Automatically reboot system if any upgraded package requires it, immediately after the upgrade.
* Default: `false`
* `unattended_automatic_reboot_time`: Automatically reboot system if any upgraded package requires it, at the specific time (_HH:MM_) instead of immediately after the upgrade.
Expand Down
8 changes: 6 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ unattended_mail: false
unattended_mail_only_on_error: false

#Unattended-Upgrade::Remove-Unused-Dependencies
# Do automatic removal of new unused dependencies after the upgrade
# Do automatic removal of all unused dependencies after the upgrade
# (equivalent to apt-get autoremove)
unattended_remove_unused_dependencies: false

#Unattended-Upgrade::Remove-New-Unused-Dependencies
# Remove any new unused dependencies after the upgrade
unattended_remove_new_unused_dependencies: true

#Unattended-Upgrade::Automatic-Reboot
# Automatically reboot *WITHOUT CONFIRMATION* if a
# the file /var/run/reboot-required is found after the upgrade
Expand Down Expand Up @@ -119,4 +123,4 @@ unattended_dpkg_options: []


# Use apt bandwidth limit feature, this example limits the download speed to 70kb/sec
#unattended_dl_limit: 70
#unattended_dl_limit: 70
7 changes: 6 additions & 1 deletion templates/unattended-upgrades.j2
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,16 @@ Unattended-Upgrade::MailOnlyOnError "true";
{% endif %}

{% if unattended_remove_unused_dependencies %}
// Do automatic removal of new unused dependencies after the upgrade
// Do automatic removal of all unused dependencies after the upgrade
// (equivalent to apt-get autoremove)
Unattended-Upgrade::Remove-Unused-Dependencies "true";
{% endif %}

{% if not unattended_remove_new_unused_dependencies %}
// Do automatic removal of new unused dependencies after the upgrade
Unattended-Upgrade::Remove-New-Unused-Dependencies "false";
{% endif %}

{% if unattended_automatic_reboot %}
// Automatically reboot *WITHOUT CONFIRMATION* if a
// the file /var/run/reboot-required is found after the upgrade
Expand Down

0 comments on commit 9960a79

Please sign in to comment.