Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/madwork/chef-apt-periodic

Chef cookbook for configuring Apt::Periodic and unattended-upgrades package on Ubuntu.
https://github.com/madwork/chef-apt-periodic

chef-cookbook unattended-upgrades

Last synced: about 1 month ago
JSON representation

Chef cookbook for configuring Apt::Periodic and unattended-upgrades package on Ubuntu.

Awesome Lists containing this project

README

        

# APT::Periodic Cookbook

[![Build Status](https://img.shields.io/travis/madwork/chef-apt-periodic.svg)](https://travis-ci.org/madwork/chef-apt-periodic)
[![Cookbook Version](https://img.shields.io/cookbook/v/apt-periodic.svg)](https://supermarket.getchef.com/cookbooks/apt-periodic)

Chef cookbook for configuring **APT::Periodic** variables for daily cron job `/etc/cron.daily/apt` and [unattended-upgrades](http://packages.ubuntu.com/precise/unattended-upgrades) package on Ubuntu.

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

## Requirements

#### supports

- `ubuntu >= 12.04`

#### depends

- `apt`

## Installation

### From the [Community Site](https://supermarket.getchef.com/cookbooks/apt-periodic)

Use the knife command:

```sh
$ knife cookbook site install apt-periodic
```

### With [librarian-chef](https://github.com/applicationsonline/librarian-chef)

Edit `Cheffile`

site "https://supermarket.getchef.com/api/v1"

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

Resolves and installs all of the dependencies:

```sh
$ librarian-chef install
```

### With [berkshelf](http://berkshelf.com/)

Edit `Berksfile`

source "https://supermarket.getchef.com"

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

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

```sh
$ berks install
```

## Attributes

#### apt-periodic::default

See [attributes/default.rb](attributes/default.rb)


Description
Type
Default


['apt_periodic']['auto_apt_enable']


Enable the update/upgrade script (0=disable)
String
"1"


['apt_periodic']['update_interval']


Do "apt-get update" automatically every n-days (0=disable)
String
"1"


['apt_periodic']['download_upgradeable_interval']


Do "apt-get upgrade --download-only" every n-days (0=disable)
String
"0"


['apt_periodic']['debdelta']


Use debdelta-upgrade to download updates if available (0=disable)
String
"1"


['apt_periodic']['autoclean_interval']


Do "apt-get autoclean" every n-days (0=disable)
String
"0"


['apt_periodic']['backup_level']


Backup level (0=disable), 1 is invalid.
String
"3"


['apt_periodic']['backup_archive_interval']


Backup after n-days if archive contents changed (0=disable)
String
"0"


['apt_periodic']['random_sleep']


Sleep for a random interval of time
String
"1800"


['apt_periodic']['verbose']


Set VERBOSE mode from apt-config
String
"0"


['apt_periodic']['min_age']


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"


['apt_periodic']['max_age']


Set maximum allowed age of a cache package file. If a cache package file is older it is deleted (0=disable)
String
"2"


['apt_periodic']['max_size']


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"


['apt_periodic']['unattended_upgrade_interval']


Run the "unattended-upgrade" security upgrade script every n-days (0=disabled)
String
"0"


['apt_periodic']['unattended_upgrades']['allowed_origins']


Automatically upgrade packages from these (origin:archive) pairs
Array



['apt_periodic']['unattended_upgrades']['package_blacklist']


List of packages to not update
Array
[]


['apt_periodic']['unattended_upgrades']['auto_fix_interrupted_dpkg']


This option allows you to control if on a unclean dpkg exit unattended-upgrades will automatically run dpkg --force-confold --configure -a
String
"true"


['apt_periodic']['unattended_upgrades']['minimal_steps']


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"


['apt_periodic']['unattended_upgrades']['install_on_shutdown']


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"


['apt_periodic']['unattended_upgrades']['mail']


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
""


['apt_periodic']['unattended_upgrades']['mail_only_on_error']


Set this value to "true" to get emails only on errors.
String
"false"


['apt_periodic']['unattended_upgrades']['remove_unused_dependencies']


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


['apt_periodic']['unattended_upgrades']['automatic_reboot']


Automatically reboot *WITHOUT CONFIRMATION* if a the file /var/run/reboot-required is found after the upgrade
String
"false"

## Usage

#### apt-periodic::default

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:

```json
{
"name": "app.crazy-automation.io",
"apt_periodic": {
"unattended_upgrade_interval": "1",
"unattended_upgrades": {
"mail": "[email protected]"
}
},
"run_list": [
"recipe[apt-periodic]"
]
}
```

## Development

#### Dependencies

* [bundler](http://bundler.io/)
* [vagrant](https://www.vagrantup.com/)
* [kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant)
* [berkshelf](http://berkshelf.com/)

#### Installation

Ensure the gem dependencies are installed:

```sh
$ bundle install
$ bundle exec berks install
```

Running the tests:

```sh
$ bundle exec rspec
$ bundle exec kitchen test
```

## Contributing

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

## License

Written by [Vincent Durand](https://github.com/madwork).

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