Skip to content
Chef cookbook for configuring Apt::Periodic and unattended-upgrades package on Ubuntu.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

APT::Periodic Cookbook

Build Status Cookbook Version

Chef cookbook for configuring APT::Periodic variables for daily cron job /etc/cron.daily/apt and unattended-upgrades package on Ubuntu.

  • /etc/apt/apt.conf.d/10periodic
  • /etc/apt/apt.conf.d/50unattended-upgrades



  • ubuntu >= 12.04


  • apt


From the Community Site

Use the knife command:

$ knife cookbook site install apt-periodic

With librarian-chef

Edit Cheffile

site ""

cookbook 'apt-periodic', '~> 0.2.0'

Resolves and installs all of the dependencies:

$ librarian-chef install

With berkshelf

Edit Berksfile

source ""

cookbook 'apt-periodic', '~> 0.2.0'

Install the cookbooks you specified in the Berksfile and their dependencies:

$ berks install



See attributes/default.rb

Description Type Default
Enable the update/upgrade script (0=disable) String "1"
Do "apt-get update" automatically every n-days (0=disable) String "1"
Do "apt-get upgrade --download-only" every n-days (0=disable) String "0"
Use debdelta-upgrade to download updates if available (0=disable) String "1"
Do "apt-get autoclean" every n-days (0=disable) String "0"
Backup level (0=disable), 1 is invalid. String "3"
Backup after n-days if archive contents changed (0=disable) String "0"
Sleep for a random interval of time String "1800"
Set VERBOSE mode from apt-config String "0"
Set minimum age of a package file. If a file is younger it will not be deleted (0=disable). Usefull to prevent races and to keep backups of the packages for emergency. String "0"
Set maximum allowed age of a cache package file. If a cache package file is older it is deleted (0=disable) String "2"
Set maximum size of the cache in MB (0=disable). If the cache is bigger, cached package files are deleted until the size requirement is met (the biggest packages will be deleted first). String "0"
Run the "unattended-upgrade" security upgrade script every n-days (0=disabled) String "0"
Automatically upgrade packages from these (origin:archive) pairs Array
List of packages to not update Array []
This option allows you to control if on a unclean dpkg exit unattended-upgrades will automatically run dpkg --force-confold --configure -a String "true"
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) String "false"
Install all unattended-upgrades when the machine is shuting down instead of doing it in the background while the machine is running. This will (obviously) make shutdown slower String "false"
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. String ""
Set this value to "true" to get emails only on errors. String "false"
Do automatic removal of new unused dependencies after the upgrade (equivalent to apt-get autoremove) String "true"
Automatically reboot *WITHOUT CONFIRMATION* if a the file /var/run/reboot-required is found after the upgrade String "false"



Just include apt-periodic in your node's run_list and override default values if needed.

Example with unattended upgrades every days and notification by mail:

  "name": "",
  "apt_periodic": {
    "unattended_upgrade_interval": "1",
    "unattended_upgrades": {
      "mail": ""
  "run_list": [




Ensure the gem dependencies are installed:

$ bundle install
$ bundle exec berks install

Running the tests:

$ bundle exec rspec
$ bundle exec kitchen test


  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github


Written by Vincent Durand.

Released under the terms of the MIT License. For further information, please see the file LICENSE.txt.

You can’t perform that action at this time.