cookbook 'debian', '= 1.7.2'
debian (10) Versions 1.7.2 Follow7
Sets up Debian repositories
cookbook 'debian', '= 1.7.2', :supermarket
knife supermarket install debian
knife supermarket download debian
Debian Cookbook
Table of Contents
Description
Chef cookbook for managing Apt sources for official Debian repositories.
This cookbook can be used to configure the whole system for all the wanted
sources (stable, security, stable-updates, etc.). Just including the "default"
recipe to the run list gives a sensible default.
Individual recipes can also be used by other cookbooks that need packages for
example from the backports repository.
Requirements
Intended for use in Debian, but could be modified for other Apt based platforms.
Tested on Debian 6.0 Squeeze and Debian 7 Wheezy.
Notifications of the debian_repository
resource require Chef 11 or newer.
Otherwise the cookbook should also work with Chef 10.
Requires apt community
cookbook version 1.6 - 2.x.
Recipes
The default
recipe configures /etc/apt/sources.list using the mirror and
components specified by node attributes. It also includes other recipes if
specified via node attributes.
The other recipes configure apt to use the corresponding Debian repository:
-
backports
- Sets up apt source for Debian Backports repository. -
backports_sloppy
- Sets up apt source for Debian Backports/sloppy repository. Only supported on Squeeze. Also includes thebackports
recipe. -
security
- Sets up apt source for Debian Security Updates repository. -
sid
- Alias forunstable
recipe. -
stable_lts
- Sets up apt source for Debian Long Term Support repository. -
stable_proposed_updates
- Sets up apt source for Debian stable-proposed-updates repository and includesstable_updates
recipe. -
stable_updates
- Sets up apt source for Debian stable-updates repository. -
testing
- Sets up apt source for Debian "testing" repository with pin priority 50. -
unstable
- Sets up apt source for Debian "unstable" repository with pin priority 40.
Attributes
Attribute | Description | Default |
---|---|---|
node['debian']['mirror'] |
Default Debian mirror URI | "http://http.debian.net/debian" |
node['debian']['backports_mirror'] |
Mirror URI for backports repository |
node['debian']['mirror'] (on Squeeze derived from it) |
node['debian']['security_mirror'] |
Mirror URI for security repository | "http://security.debian.org/debian-security" |
node['debian']['components'] |
Default repository components | ["main", "contrib", "non-free"] |
node['debian']['deb_src'] |
If true, enables apt source lines by default | false |
The following attributes specify if the corresponding recipe/repository is
included by the default recipe:
Attribute | Default |
---|---|
node['debian']['backports'] |
false |
node['debian']['backports_sloppy'] |
false |
node['debian']['security'] |
true |
node['debian']['stable_lts'] |
true on Squeeze, false otherwise |
node['debian']['stable_proposed_updates'] |
false |
node['debian']['stable_updates'] |
true |
node['debian']['testing'] |
false |
node['debian']['unstable'] |
false |
Resources and Providers
debian_repository
Sets up Debian repository and optionally pinning preferences using
apt_repository
LWRP. This is used internally by the recipes, but feel free
if you find usage for it in your own cookbooks.
Attribute parameters:
-
repo_name
- Name_attribute. The name of the repository and configuration files. -
uri
- The base URI of the repository. Defaults tonode['debian']['mirror']
. -
distribution
- Name attribute. The distribution part of apt source line. -
components
- The components part of apt source line. Defaults tonode['debian']['components']
. -
deb_src
- If true, enables apt source line too. Defaults tonode['debian']['deb_src']
. -
pin_priority
- The default pinning priority for the repository. Defaults to nil which means that no preferences are set.
Example:
# feel the history debian_repository "woody" do uri "http://archive.debian.org/debian" pin_priority 200 end
Usage
If you want to manage /etc/apt/souces.list
with Chef, add the default recipe
to the run list, preferably as the first one. The default recipe also includes
"apt::default" recipe, so you don't need to add it.
Then you can also specify which additional repositories are configured by
setting node['debian']['<repo>']
attributes to true or false. By default
a standard set is included. The other option is to add the wanted repositories
(e.g. recipe[debian::backports]
) directly to the run list.
The default base URI (http.debian.net) should be fine for most cases as it
redirects to a geographically closest mirror. You can also to set it explicitly
for example in a role:
default_attributes( :debian => { :mirror => "http://ftp.fi.debian.org/debian" } )
Other cookbooks that need packages from a specific repository should depend on
this cookbook, include the corresponding repository recipe and possibly add
apt-pinning rules for the packages as needed. Example:
# configure backports.debian.org include_recipe "debian::backports" # set apt-pinning rules %w[thepackage and some dependencies].each do |pkg| apt_preference pkg do pin "release o=Debian Backports" pin_priority "700" end end # install the package package "thepackage"
License and Author
Author:: Teemu Matilainen <teemu.matilainen@reaktor.fi>
Copyright © 2011-2014, Reaktor Innovations Oy
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE).
1.7.2 / 2014-08-22
Improvements:
- Loosen the apt cookbook requirement to accept all 2.x versions, as v2.5.2 fixes GH-15. So apt cookbook versions 2.5.0 and 2.5.1 are broken, earlier and later ones should work fine.
1.7.0 / 2014-08-13
Deprecations:
- Notifications of the
debian_repository
resource require Chef 11 or newer.
Features:
- Add
stable_lts
recipe for the Long Term Support repository. Enabled by default on Squeeze. (GH-14)
Improvements:
- Use
use_inline_resources
in the provider to ensure correct notification behavior. - Lock down apt cookbook requirement to
< 2.5.0
as it removed/renamed theexecute[apt-get update]
resource. (GH-15)
Bug fixes:
- Fix
pin
line in apt preferences
1.6.0 / 2014-04-20
Features:
- Allow specifying the security mirror with
security_mirror
attribute (GH-11)
1.5.4 / 2013-06-20
- Fix Wheezy version number detection (GH-10)
- Point-releases only have two numbers, latest is 7.1
- Fix tests on Chef 10
- Lock down apt cookbook
- Refactor ChefSpec tests and add unit tests for library methods (GH-9)
1.5.2 / 2013-06-13
- Use Emeril to help releasing
- Test setup improvements
1.5.0 / 2013-05-20
- On squeeze use default mirror with /debian-backports suffix for backports
repository (GH-7)
- Only fall back to backports.debian.org if the mirror URI does not end with /debian
- Should work on most cases, but
node['debian']['backports_mirror']
can be used for setting an explicit URI
- Add
backports_sloppy
recipe for squeeze-backports-sloppy suite (GH-8)
1.4.0 / 2013-05-14
- First community site release! Replaces the earlier "debian" cookbook.
- Huge thanks and respect to Guilhem Lettron for giving the community site cookbook name for us.
- This version can be used as a drop-in replacement with default attributes in some cases, but any custom node attributes for the old cookbook do not work.
- Please read the [readme](README.md) for usage instructions.
- Improve the readme
- Specify platform versions for Fauxhai in ChefSpec tests
1.3.2 / 2013-05-07
- Fix non-lsb codename detection on first Wheezy release (GH-6)
1.3.0 / 2013-05-06
- Use http.debian.net as a default mirror
- Don't rely on
lsb_release
being installed (GH-6) - More ChefSpec tests
- Add simple Test Kitchen 1.0 setup
1.2.0 / 2013-03-22
- Use new backports URL from Wheezy on (GH-5)
- Include apt recipe only after sources.list has been updated
- Add chefspec tests (GH-2)
- Other test and Vagrant environment improvements
1.1.2 / 2013-02-06
- Use
apt_preference
resource to create the repo pinning rule - Remove the
apt-get update
workaround (GH-3) - Add foodcritic and Knife cookbook tests (GH-2)
- Test with latest Chef 10 and 11 releases on Travis
1.1.0 / 2013-01-21
- Workaround for apt cookbook not running
apt-get update
on apt_repository updates (GH-3) - Vagrant setup for manual testing (GH-1)
1.0.0 / 2013-01-18
- Initial public release