(MAINT) improve hiera description
[puppet-modules/puppetlabs-apt.git] / README.md
index 0592202f5ab27a62842d4a418ebf6670c34f7f8b..5ab4275a3896a110091eaa064d5320322ac9e796 100644 (file)
--- a/README.md
+++ b/README.md
@@ -30,11 +30,12 @@ Apt (Advanced Package Tool) is a package manager available on Debian, Ubuntu, an
 
 ### What apt affects
 
+* Your system's `preferences` file and `preferences.d` directory
 * Your system's `sources.list` file and `sources.list.d` directory
 * System repositories
 * Authentication keys
 
-**Note:** Setting the apt module's `purge_sources_list` and `purge_sources_list_d` parameters to 'true' will destroy any existing content that you haven't declared through Puppet. The default for these parameters is 'false'.
+**Note:** This module offers `purge` parameters which, if set to 'true', **destroy** any configuration on the node's `sources.list(.d)` and `preferences(.d)` that you haven't declared through Puppet. The default for these parameters is 'false'.
 
 ### Beginning with apt
 
@@ -149,16 +150,21 @@ apt::source { 'puppetlabs':
 
 ### Configure Apt from Hiera
 
+Instead of specifying your sources directly as resources, you can instead just
+include the `apt` class, which will pick up the values automatically from
+hiera.
+
 ~~~yaml
 apt::sources:
   'debian_unstable':
+    comment: 'This is the iWeb Debian unstable mirror'
     location: 'http://debian.mirror.iweb.ca/debian/'
     release: 'unstable'
     repos: 'main contrib non-free'
+    pin: '-10'
     key:
-      id: '9AA38DCD55BE302B'
+      id: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553'
       server: 'subkeys.pgp.net'
-    pin: '-10'
     include:
       src: true
       deb: true
@@ -228,19 +234,23 @@ Main class, includes all other classes.
 
   * 'https': Specifies whether to enable https proxies. Valid options: 'true' and 'false'. Default: 'false'.
 
+  * 'ensure': Optional parameter. Valid options: 'file', 'present', and 'absent'. Default: 'undef'. Prefer 'file' over 'present'.
+
 * `purge`: Specifies whether to purge any existing settings that aren't managed by Puppet. Valid options: a hash made up from the following keys:
 
   * 'sources.list': Specifies whether to purge any unmanaged entries from `sources.list`. Valid options: 'true' and 'false'. Default: 'false'.
 
   * 'sources.list.d': Specifies whether to purge any unmanaged entries from `sources.list.d`. Valid options: 'true' and 'false'. Default: 'false'.
 
-  * 'preferences.list': Specifies whether to purge any unmanaged entries from `preferences.list`. Valid options: 'true' and 'false'. Default: 'false'.
+  * 'preferences': Specifies whether to purge any unmanaged entries from `preferences`. Valid options: 'true' and 'false'. Default: 'false'.
 
-  * 'preferences.list.d': Specifies whether to purge any unmanaged entries from `preferences.list.d`. Valid options: 'true' and 'false'. Default: 'false'.
+  * 'preferences.d': Specifies whether to purge any unmanaged entries from `preferences.d`. Valid options: 'true' and 'false'. Default: 'false'.
 
 * `settings`: Creates new `apt::setting` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
 
-* `sources`: Creates new `apt::setting` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
+* `sources`: Creates new `apt::source` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
+
+* `pins`: Creates new `apt::pin` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
 
 * `update`: Configures various update settings. Valid options: a hash made up from the following keys:
 
@@ -263,8 +273,8 @@ Manages backports.
 
 * `location`: Specifies an Apt repository containing the backports to manage. Valid options: a string containing a URL. Defaults:
 
-  * Debian (squeeze): 'http://backports.debian.org/debian-backports'
-  * Debian (other): 'http://ftp.debian.org/debian/'
+  * Debian (squeeze): 'http://httpredir.debian.org/debian-backports'
+  * Debian (other): 'http://httpredir.debian.org/debian'
   * Ubuntu: 'http://archive.ubuntu.com/ubuntu'
 
 * `pin`: *Optional.* Specifies a pin priority for the backports. Valid options: a number or string to be passed to the `id` parameter of the `apt::pin` define, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. Default: '200'.
@@ -288,6 +298,8 @@ Specifies a custom Apt configuration file.
 
 * `priority`: *Optional.* Determines the order in which Apt processes the configuration file. Files with lower priority numbers are loaded first. Valid options: a string containing an integer. Default: '50'.
 
+* `notify_update`: *Optional.* Specifies whether to trigger an `apt-get update` run. Valid options: 'true' and 'false'. Default: 'true'.
+
 #### Define: `apt::key`
 
 Manages the GPG keys that Apt uses to authenticate packages.
@@ -320,7 +332,7 @@ The `apt::key` define makes use of the `apt_key` type, but includes extra functi
 
 #### Define: `apt::pin`
 
-Manages Apt pins.
+Manages Apt pins. Does not trigger an `apt-get update` run.
 
 **Note:** For context on these parameters, we recommend reading the man page ['apt_preferences(5)'](http://linux.die.net/man/5/apt_preferences)
 
@@ -455,6 +467,14 @@ Manages the GPG keys that Apt uses to authenticate packages.
 
 This module is tested and officially supported on Debian 6 and 7 and Ubuntu 10.04, 12.04, and 14.04. Testing on other platforms has been light and cannot be guaranteed.
 
+### Adding new sources or PPAs
+
+If you are adding a new source or PPA and trying to install packages from the new source or PPA on the same Puppet run, your `package` resource should depend on `Class['apt::update']`, in addition to depending on the `Apt::Source` or the `Apt::Ppa`. You can also add [collectors](https://docs.puppetlabs.com/puppet/latest/reference/lang_collectors.html) to ensure that all packages happen after `apt::update`, but this can lead to dependency cycles and has implications for [virtual resources](https://docs.puppetlabs.com/puppet/latest/reference/lang_collectors.html#behavior).
+
+~~~puppet
+Class['apt::update'] -> Package<| |>
+~~~
+
 ## Development
 Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.