2013-01-14 23:07:24 +01:00
puppetdb
=========
####Table of Contents
1. [Overview - What is the PuppetDB module? ](#overview )
2. [Module Description - What does the module do? ](#module-description )
3. [Setup - The basics of getting started with PuppetDB module ](#setup )
2013-10-04 14:01:29 +02:00
4. [Upgrading - Guide for upgrading from older revisions of this module ](#upgrading )
2013-01-14 23:07:24 +01:00
4. [Usage - The classes and parameters available for configuration ](#usage )
5. [Implementation - An under-the-hood peek at what the module is doing ](#implementation )
6. [Limitations - OS compatibility, etc. ](#limitations )
7. [Development - Guide for contributing to the module ](#development )
8. [Release Notes - Notes on the most recent updates to the module ](#release-notes )
Overview
2012-09-19 00:59:44 +02:00
--------
2015-10-10 00:02:23 +02:00
By guiding puppetdb setup and configuration with a Puppet master, the PuppetDB
module provides fast, streamlined access to data on puppetized infrastructure.
2013-01-14 23:07:24 +01:00
Module Description
-------------------
2013-01-29 16:23:01 +01:00
2015-10-10 00:02:23 +02:00
The PuppetDB module provides a quick way to get started using PuppetDB, an open
source inventory resource service that manages storage and retrieval of
platform-generated data. The module will install PostgreSQL and PuppetDB if you
don't have them, as well as set up the connection to Puppet master. The module
will also provide a dashboard you can use to view the current state of your
system.
For more information about PuppetDB
[please see the official PuppetDB documentation. ](http://docs.puppetlabs.com/puppetdb/ )
2013-01-14 23:07:24 +01:00
Setup
-----
**What PuppetDB affects:**
* package/service/configuration files for PuppetDB
* package/service/configuration files for PostgreSQL (optional, but set as default)
2015-10-10 00:02:23 +02:00
* Puppet master's runtime (via plugins)
* Puppet master's configuration
* **note**: Using the `puppetdb::master::config` class will cause your
routes.yaml file to be overwritten entirely (see **Usage** below for options
and more information )
2013-01-14 23:07:24 +01:00
* system firewall (optional)
* listened-to ports
**Introductory Questions**
To begin using PuppetDB, you’ ll have to make a few decisions:
2013-01-29 16:23:01 +01:00
* Which database back-end should I use?
* PostgreSQL (default) or our embedded database
* Embedded database
2015-10-10 00:02:23 +02:00
* **note:** We suggest using the embedded database only for experimental
environments rather than production, as it does not scale well and can
cause difficulty in migrating to PostgreSQL.
2013-01-14 23:07:24 +01:00
* Should I run the database on the same node that I run PuppetDB on?
* Should I run PuppetDB on the same node that I run my master on?
2015-10-10 00:02:23 +02:00
The answers to those questions will be largely dependent on your answers to
questions about your Puppet environment:
2013-01-29 16:23:01 +01:00
* How many nodes are you managing?
* What kind of hardware are you running on?
2013-01-14 23:07:24 +01:00
* Is your current load approaching the limits of your hardware?
2015-10-10 00:02:23 +02:00
Depending on your answers to all of the questions above, you will likely fall
under one of these set-up options:
2013-01-14 23:07:24 +01:00
1. [Single Node (Testing and Development) ](#single-node-setup )
2. [Multiple Node (Recommended) ](#multiple-node-setup )
### Single Node Setup
2015-10-10 00:02:23 +02:00
This approach assumes you will use our default database (PostgreSQL) and run
everything (PostgreSQL, PuppetDB, Puppet master) all on the same node. This
setup will be great for a testing or experimental environment. In this case,
your manifest will look like:
2013-01-29 16:23:01 +01:00
2015-10-10 00:02:23 +02:00
node < hostname > {
2013-01-14 23:07:24 +01:00
# Configure puppetdb and its underlying database
2013-01-29 16:23:01 +01:00
class { 'puppetdb': }
2015-10-10 00:02:23 +02:00
# Configure the Puppet master to use puppetdb
2013-01-29 16:23:01 +01:00
class { 'puppetdb::master::config': }
2013-01-14 23:07:24 +01:00
}
2015-10-10 00:02:23 +02:00
You can provide some parameters for these classes if you’ d like more control,
but that is literally all that it will take to get you up and running with the
default configuration.
2013-01-14 23:07:24 +01:00
### Multiple Node Setup
2015-10-10 00:02:23 +02:00
This approach is for those who prefer not to install PuppetDB on the same node
as the Puppet master. Your environment will be easier to scale if you are able
to dedicate hardware to the individual system components. You may even choose to
run the puppetdb server on a different node from the PostgreSQL database that it
uses to store its data. So let’ s have a look at what a manifest for that
scenario might look like:
2013-01-14 23:07:24 +01:00
**This is an example of a very basic 3-node setup for PuppetDB.**
2015-10-10 00:02:23 +02:00
$master_host = 'master.example.lan'
$puppetdb_host = 'puppetdb.example.lan'
$postgres_host = 'postgres.example.lan'
node $master_host {
# Here we configure the Puppet master to use PuppetDB,
# telling it the hostname of the PuppetDB node
2013-01-14 23:07:24 +01:00
class { 'puppetdb::master::config':
2015-10-10 00:02:23 +02:00
puppetdb_server => $puppetdb_host,
2013-01-14 23:07:24 +01:00
}
}
2015-10-10 00:02:23 +02:00
node $postgres_host {
# Here we install and configure PostgreSQL and the PuppetDB
# database instance, and tell PostgreSQL that it should
# listen for connections to the `$postgres_host`
2013-01-14 23:07:24 +01:00
class { 'puppetdb::database::postgresql':
2015-10-10 00:02:23 +02:00
listen_addresses => $postgres_host,
2013-01-14 23:07:24 +01:00
}
}
2015-10-10 00:02:23 +02:00
node $puppetdb_host {
2013-01-14 23:07:24 +01:00
# Here we install and configure PuppetDB, and tell it where to
2015-10-10 00:02:23 +02:00
# find the PostgreSQL database.
2013-01-14 23:07:24 +01:00
class { 'puppetdb::server':
2015-10-10 00:02:23 +02:00
database_host => $postgres_host,
2013-01-14 23:07:24 +01:00
}
}
2013-01-29 16:23:01 +01:00
2015-10-10 00:02:23 +02:00
This should be all it takes to get a 3-node, distributed installation of
PuppetDB up and running. Note that, if you prefer, you could easily move two of
these classes to a single node and end up with a 2-node setup instead.
2013-01-14 23:07:24 +01:00
2013-01-29 16:23:01 +01:00
### Beginning with PuppetDB
2013-01-14 23:07:24 +01:00
2015-10-10 00:02:23 +02:00
Whether you choose a single node development setup or a multi-node setup, a
basic setup of PuppetDB will cause: PostgreSQL to install on the node if it’ s
not already there; PuppetDB postgres database instance and user account to be
created; the postgres connection to be validated and, if successful, PuppetDB to
be installed and configured; PuppetDB connection to be validated and, if
successful, the Puppet master config files to be modified to use PuppetDB; and
the Puppet master to be restarted so that it will pick up the config changes.
2013-01-14 23:07:24 +01:00
2015-10-10 00:02:23 +02:00
If your logging level is set to INFO or finer, you should start seeing
PuppetDB-related log messages appear in both your Puppet master log and your
puppetdb log as subsequent agent runs occur.
If you’ d prefer to use PuppetDB’ s embedded database rather than PostgreSQL, have
a look at the database parameter on the puppetdb class:
2013-01-29 16:23:01 +01:00
2013-01-14 23:07:24 +01:00
class { 'puppetdb':
database => 'embedded',
}
2013-01-29 16:23:01 +01:00
2015-10-10 00:02:23 +02:00
The embedded database can be useful for testing and very small production
environments, but it is not recommended for production environments since it
consumes a great deal of memory as your number of nodes increase.
2013-01-14 23:07:24 +01:00
### Cross-node Dependencies
2015-10-10 00:02:23 +02:00
It is worth noting that there are some cross-node dependencies, which means that
the first time you add the module's configurations to your manifests, you may
see a few failed puppet runs on the affected nodes.
2016-03-14 20:25:41 +01:00
PuppetDB handles cross-node dependencies by taking a sort of "eventual
consistency" approach. There’ s nothing that the module can do to control the
2015-10-10 00:02:23 +02:00
order in which your nodes check in, but the module can check to verify that the
services it depends on are up and running before it makes configuration
changes--so that’ s what it does.
When your Puppet master node checks in, it will validate the connectivity to the
puppetdb server before it applies its changes to the Puppet master config files.
If it can’ t connect to puppetdb, then the puppet run will fail and the previous
config files will be left intact. This prevents your master from getting into a
broken state where all incoming puppet runs fail because the master is
configured to use a puppetdb server that doesn’ t exist yet. The same strategy is
used to handle the dependency between the puppetdb server and the postgres
server.
Hence the failed puppet runs. These failures should be limited to 1 failed run
on the puppetdb node, and up to 2 failed runs on the Puppet master node. After
that, all of the dependencies should be satisfied and your puppet runs should
start to succeed again.
You can also manually trigger puppet runs on the nodes in the correct order
(Postgres, PuppetDB, Puppet master), which will avoid any failed runs.
2013-01-14 23:07:24 +01:00
2013-10-04 14:01:29 +02:00
Upgrading
---------
2016-03-14 20:25:41 +01:00
### Upgrading from 4.x to 5.x
2015-05-15 23:10:08 +02:00
Significant parameter changes are listed below:
2016-03-14 20:25:41 +01:00
* The PuppetDB module defaults to Puppet 4 pathing and assumes `puppetserver`
is the master service by default
* The PuppetDB module manages Postgres repos by default. To turn this behavior
off, set `manage_package_repo` to `false` .
* To specify a specific version of PuppetDB to manage, you'll need to use the
`puppetdb::globals` class to set the version of PuppetDB you're using
explicitly. The ability to configure the version in the `puppetdb::server` and
`puppetdb` class have been removed.
2015-10-10 00:02:23 +02:00
2015-06-17 21:02:09 +02:00
For example if your config looked like this before:
2015-10-10 00:02:23 +02:00
class {'puppetdb':
2016-03-14 20:25:41 +01:00
puppetdb_version => '3.2.4-1.el7',
2015-10-10 00:02:23 +02:00
}
class { 'puppetdb::master::config': }
2016-03-14 20:25:41 +01:00
and you'd still like to use the module with PuppetDB 3.2.4, all you'd have to
change would be:
2015-10-10 00:02:23 +02:00
class { 'puppetdb::globals':
2016-03-14 20:25:41 +01:00
version => '3.2.4-1.el7',
2015-10-10 00:02:23 +02:00
}
class { 'puppetdb' : }
class { 'puppetdb::master::config' : }
The `globals` class above takes into account the following PuppetDB 3 and Puppet
4 related changes:
* The `puppetdb::master:puppetdb_conf` class has added a `$legacy_terminus`
to support the PuppetDB 2.x terminus configuration.
* The default `test_url` for the `PuppetDBConnValidator` has also been
chaged to `/pdb/meta/v1/version` but will default to `/v3/version` when
using a PuppetDB 2.x version.
* The configuration pathing for Puppet and PuppetDB has changed with Puppet
4 and PuppetDB 3, using PuppetDB 2.x or older assumes the old
configuration pathing.
2015-05-15 23:10:08 +02:00
See the CHANGELOG file for more detailed information on changes for each release.
2016-03-14 20:25:41 +01:00
### Upgrading from 3.x to 4.x
2014-09-16 16:14:58 +02:00
2015-10-10 00:02:23 +02:00
For this release, all dependency versions have been bumped to their latest.
Significant parameter changes are listed below:
2014-09-16 16:14:58 +02:00
* The PuppetDB module now only supports Puppet 3.7.1 or later
2015-10-10 00:02:23 +02:00
* `puppetlabs/postgresql` 4.0.0 or later is now required
* `puppetlabs/inifile` 1.1.3 or later is now required
* `puppetlabs/firewall` 1.1.3 or later is now required
* `puppetlabs/stdlib` 4.2.2 or later is now required
* The parameter `manage_firewall` for the class `puppetdb::database::postgresql`
has now been removed, since the PostgreSQL module no longer supports this.
* The parameter `open_postgres_port` for the class `puppetdb` has also been
removed, due to PostgreSQL changes.
2014-09-16 16:14:58 +02:00
See the CHANGELOG file for more detailed information on changes for each release.
2016-03-14 20:25:41 +01:00
### Upgrading from 2.x to 3.x
2013-10-21 17:21:12 +02:00
2015-10-10 00:02:23 +02:00
For this release a major dependency has changed. The module
`pupppetlabs/postgresql` must now be version 3.x. Upgrading the module should
upgrade the `puppetlabs/postgresql` module for you, but if another module has a
fixed dependency that module will have to be fixed before you can continue.
2013-10-21 17:21:12 +02:00
Some other changes include:
2015-10-10 00:02:23 +02:00
* The parameter `manage_redhat_firewall` for the class `puppetdb` has now been
removed completely in favor of `open_postgres_port` and
`open_ssl_listen_port` .
* The parameter `manage_redhat_firewall` for the class
`puppetdb::database::postgresql` , has now been renamed to `manage_firewall` .
* The parameter `manage_redhat_firewall` for the class `puppetdb::server` has
now been removed completely in favor of `open_listen_port` and
`open_ssl_listen_port` .
* The internal class: `puppetdb::database::postgresql_db` has been removed. If
you were using this, it is now defunct.
* The class `puppetdb::server::firewall` has been marked as private, do not use
it directly.
* The class `puppetdb::server::jetty_ini` and `puppetdb::server::database_ini`
have been marked as private, do not use it directly.
2013-10-21 17:21:12 +02:00
2016-03-14 20:25:41 +01:00
### Upgrading from 1.x to 2.x
2013-10-04 14:01:29 +02:00
2015-10-10 00:02:23 +02:00
A major dependency has been changed, so now when you upgrade to 2.0 the
dependency `cprice404/inifile` has been replaced with `puppetlabs/inifile` . This
may interfere with other modules as they may depend on the old
`cprice404/inifile` instead, so upgrading should be done with caution. Check
that your other modules use the newer `puppetlabs/inifile` module as
interoperation with the old `cprice404/inifile` module will no longer be
supported by this module.
2013-10-04 14:01:29 +02:00
2015-10-10 00:02:23 +02:00
Depending on how you install your modules, changing the dependency may require
manual intervention. Double check your modules contain the newer
`puppetlabs/inifile` after installing this latest module.
2013-10-04 14:01:29 +02:00
Otherwise, all existing parameters from 1.x should still work correctly.
2013-01-14 23:07:24 +01:00
Usage
------
2015-10-10 00:02:23 +02:00
PuppetDB supports a large number of configuration options for both configuring
the puppetdb service and connecting that service to the Puppet master.
2013-01-14 23:07:24 +01:00
2015-06-18 22:45:51 +02:00
### puppetdb::globals
2015-10-10 00:02:23 +02:00
The `puppetdb::globals` class is intended to provide similar functionality to
the `postgresql::globals` class in the `puppetlabs-postgresql` module by
exposing a top-level entry-point into the module so that we can properly set
defaults for the `puppetdb::params` class based on the version of `puppetdb` you
are using. This setting defaults to `present` .
2015-06-18 22:45:51 +02:00
You must declare the class to use it:
class { 'puppetdb::globals': }
**Parameters within `puppetdb::globals` :**
####`version`
2015-10-10 00:02:23 +02:00
The version of the `puppetdb` package that should be installed. You may specify
an explicit version number, 'present', or 'latest' (defaults to 'present').
2015-06-18 22:45:51 +02:00
2013-01-14 23:07:24 +01:00
### puppetdb
2015-10-10 00:02:23 +02:00
The `puppetdb` class is intended as a high-level abstraction (sort of an
'all-in-one' class) to help simplify the process of getting your puppetdb server
up and running. It wraps the slightly-lower-level classes `puppetdb::server` and
`puppetdb::database::*` , and it'll get you up and running with everything you
need (including database setup and management) on the server side. For maximum
configurability, you may choose not to use this class. You may prefer to use the
`puppetdb::server` class directly, or manage your puppetdb setup on your own.
2013-01-14 23:07:24 +01:00
You must declare the class to use it:
2013-01-29 16:23:01 +01:00
class { 'puppetdb': }
2013-01-14 23:07:24 +01:00
**Parameters within `puppetdb` :**
####`listen_address`
2015-10-10 00:02:23 +02:00
The address that the web server should bind to for HTTP requests. Defaults to
`localhost` . Set to `0.0.0.0` to listen on all addresses.
2013-01-14 23:07:24 +01:00
####`listen_port`
2015-10-10 00:02:23 +02:00
The port on which the puppetdb web server should accept HTTP requests. Defaults
to `8080` .
2013-01-14 23:07:24 +01:00
2015-10-13 19:39:15 +02:00
####`disable_cleartext`
If true, the puppetdb web server will only serve HTTPS and not HTTP requests (defaults to false).
2013-01-14 23:07:24 +01:00
####`open_listen_port`
2015-10-10 00:02:23 +02:00
If `true` , open the `http_listen_port` on the firewall. Defaults to `false` .
2013-01-14 23:07:24 +01:00
####`ssl_listen_address`
2015-10-10 00:02:23 +02:00
The address that the web server should bind to for HTTPS requests. Defaults to
`0.0.0.0` to listen on all addresses.
2013-01-14 23:07:24 +01:00
####`ssl_listen_port`
2015-10-10 00:02:23 +02:00
The port on which the puppetdb web server should accept HTTPS requests. Defaults
to `8081` .
2013-01-14 23:07:24 +01:00
2013-04-10 17:20:28 +02:00
####`disable_ssl`
2015-10-10 00:02:23 +02:00
If `true` , the puppetdb web server will only serve HTTP and not HTTPS requests.
Defaults to `false` .
2013-04-10 17:20:28 +02:00
2013-01-14 23:07:24 +01:00
####`open_ssl_listen_port`
2016-03-21 20:26:00 +01:00
If true, open the `ssl_listen_port` on the firewall. Defaults to `undef` .
2013-01-14 23:07:24 +01:00
2014-11-20 14:29:27 +01:00
####`ssl_protocols`
2015-10-10 00:02:23 +02:00
Specify the supported SSL protocols for PuppetDB (e.g. TLSv1, TLSv1.1, TLSv1.2.)
2014-11-20 14:29:27 +01:00
2014-07-11 11:14:40 +02:00
###`manage_dbserver`
2015-10-10 00:02:23 +02:00
If true, the PostgreSQL server will be managed by this module. Defaults to `true` .
2014-07-11 11:14:40 +02:00
2013-01-14 23:07:24 +01:00
####`database`
2015-10-10 00:02:23 +02:00
Which database backend to use; legal values are `postgres` (default) or
`embedded` . The `embedded` db can be used for very small installations or for
testing, but is not recommended for use in production environments. For more
info, see the [puppetdb docs ](http://docs.puppetlabs.com/puppetdb/ ).
2013-01-14 23:07:24 +01:00
2014-10-07 16:06:54 +02:00
####`database_host`
2015-10-10 00:02:23 +02:00
Hostname to use for the database connection. For single case installations this
should be left as the default. Defaults to `localhost` , ignored for `embedded`
database.
2014-10-07 16:06:54 +02:00
2013-01-14 23:07:24 +01:00
####`database_port`
2015-10-10 00:02:23 +02:00
The port that the database server listens on. Defaults to `5432` , ignored for
`embedded` database.
2013-01-14 23:07:24 +01:00
####`database_username`
2015-10-10 00:02:23 +02:00
The name of the database user to connect as. Defaults to `puppetdb` , ignored for
`embedded` database.
2013-01-14 23:07:24 +01:00
####`database_password`
2015-10-10 00:02:23 +02:00
The password for the database user. Defaults to `puppetdb` , ignored for
`embedded` database.
2013-01-14 23:07:24 +01:00
####`database_name`
2015-10-10 00:02:23 +02:00
The name of the database instance to connect to. Defaults to `puppetdb` , ignored
for `embedded` database.
2013-01-14 23:07:24 +01:00
2015-09-01 23:27:51 +02:00
####`database_ssl` (DEPRECATED)
2013-10-19 19:49:48 +02:00
2015-10-10 00:02:23 +02:00
If true, PuppetDB will use SSL to connect to the postgres database. Defaults to
`false` , ignored for `embedded` database. Setting up proper trust- and keystores has to
be managed outside of the PuppetDB module.
2013-10-19 19:49:48 +02:00
2015-09-01 23:27:51 +02:00
This parameter is deprecated and will be retired in a future release. Please use
the `jdbc_ssl_properties` parameter with the value `?ssl=true` .
####`jdbc_ssl_properties`
The text to append to the JDBC connection URI. This should begin with a '?'
character. For example, to use SSL for the PostgreSQL connection, set this
parameter's value to `?ssl=true` .
This setting is only available when using PostgreSQL; when using HyperSQL (the
2015-10-10 00:02:23 +02:00
`embedded` database), it does nothing.
2015-09-01 23:27:51 +02:00
2014-12-16 10:08:35 +01:00
####`database_validate`
2015-10-10 00:02:23 +02:00
If true, the module will attempt to connect to the database using the specified
settings and fail if it is not able to do so. Defaults to `true` .
2014-12-16 10:08:35 +01:00
2015-06-10 13:46:54 +02:00
####`database_embedded_path`
2015-10-10 00:02:23 +02:00
*Embedded Database Only* Changes the path location for the HSQLDB database. Does
not provide migration for old data, so if you change this value and you have an
existing database you will need to manually move the content also. (defaults to
package default for 2.x release).
2015-06-10 13:46:54 +02:00
2013-02-07 01:08:07 +01:00
####`node_ttl`
2015-10-10 00:02:23 +02:00
The length of time a node can go without receiving any new data before it's
automatically deactivated. (defaults to '0', which disables auto-deactivation).
This option is supported in PuppetDB >= 1.1.0.
2013-02-07 01:08:07 +01:00
####`node_purge_ttl`
2015-10-10 00:02:23 +02:00
The length of time a node can be deactivated before it's deleted from the
database. (defaults to '0', which disables purging). This option is supported in
PuppetDB >= 1.2.0.
2013-02-07 01:08:07 +01:00
####`report_ttl`
2015-10-10 00:02:23 +02:00
The length of time reports should be stored before being deleted. (defaults to
`7d` , which is a 7-day period). This option is supported in PuppetDB >= 1.1.0.
2013-02-07 01:08:07 +01:00
2013-08-07 16:32:19 +02:00
####`gc_interval`
2015-10-10 00:02:23 +02:00
This controls how often (in minutes) to compact the database. The compaction
process reclaims space and deletes unnecessary rows. If not supplied, the
default is every 60 minutes. This option is supported in PuppetDB >= 0.9.
2013-08-07 16:32:19 +02:00
####`log_slow_statements`
2015-10-10 00:02:23 +02:00
This sets the number of seconds before an SQL query is considered "slow." Slow
SQL queries are logged as warnings, to assist in debugging and tuning. Note
PuppetDB does not interrupt slow queries; it simply reports them after they
complete.
2013-08-07 16:32:19 +02:00
2015-10-10 00:02:23 +02:00
The default value is `10` seconds. A value of 0 will disable logging of slow
queries. This option is supported in PuppetDB >= 1.1.
2013-08-07 16:32:19 +02:00
####`conn_max_age`
2015-10-10 00:02:23 +02:00
The maximum time (in minutes) for a pooled connection to remain unused before
it is closed off.
2013-08-07 16:32:19 +02:00
2015-10-10 00:02:23 +02:00
If not supplied, we default to `60` minutes. This option is supported in PuppetDB >= 1.1.
2013-08-07 16:32:19 +02:00
####`conn_keep_alive`
2015-10-10 00:02:23 +02:00
This sets the time (in minutes) for a connection to remain idle before sending
a test query to the DB. This is useful to prevent a DB from timing out
connections on its end.
2013-08-07 16:32:19 +02:00
2013-08-08 00:22:55 +02:00
If not supplied, we default to 45 minutes. This option is supported in PuppetDB >= 1.1.
2013-08-07 16:32:19 +02:00
####`conn_lifetime`
2015-10-10 00:02:23 +02:00
The maximum time (in minutes) a pooled connection should remain open. Any
connections older than this setting will be closed off. Connections currently in
use will not be affected until they are returned to the pool.
2013-08-07 16:32:19 +02:00
2015-10-10 00:02:23 +02:00
If not supplied, we won't terminate connections based on their age alone. This
option is supported in PuppetDB >= 1.4.
2013-08-07 16:32:19 +02:00
2013-02-05 23:34:48 +01:00
####`puppetdb_package`
2013-01-14 23:07:24 +01:00
2015-10-10 00:02:23 +02:00
The PuppetDB package name in the package manager. Defaults to `present` .
2013-01-14 23:07:24 +01:00
####`puppetdb_service`
2015-10-10 00:02:23 +02:00
The name of the PuppetDB service. Defaults to `puppetdb` .
2013-01-14 23:07:24 +01:00
2013-09-02 11:30:31 +02:00
####`puppetdb_service_status`
2015-10-10 00:02:23 +02:00
Sets whether the service should be `running ` or `stopped` . When set to `stopped` the
service doesn't start on boot either. Valid values are `true` , `running` ,
`false` , and `stopped` .
2013-09-02 11:30:31 +02:00
2013-01-14 23:07:24 +01:00
####`confdir`
2015-10-10 00:02:23 +02:00
The PuppetDB configuration directory. Defaults to `/etc/puppetdb/conf.d` .
2013-01-14 23:07:24 +01:00
2013-02-15 17:16:36 +01:00
####`java_args`
2015-10-10 00:02:23 +02:00
Java VM options used for overriding default Java VM options specified in
PuppetDB package. Defaults to `{}` . See
[PuppetDB Configuration ](http://docs.puppetlabs.com/puppetdb/1.1/configure.html )
to get more details about the current defaults.
For example, to set `-Xmx512m -Xms256m` options use:
2013-02-15 17:16:36 +01:00
2015-10-10 00:02:23 +02:00
{
'-Xmx' => '512m',
'-Xms' => '256m',
}
2013-02-15 17:16:36 +01:00
2015-09-21 23:23:12 +02:00
####`merge_default_java_args`
Sets whether the provided java args should be merged with the defaults, or
should override the defaults. This setting is necessary if any of the defaults
2015-10-10 00:02:23 +02:00
are to be removed. Defaults to true. If `false` , the `java_args` in the PuppetDB
2015-09-21 23:23:12 +02:00
init config file will reflect only what is passed via the `java_args` param.
2014-06-26 17:15:34 +02:00
####`max_threads`
2015-10-10 00:02:23 +02:00
Jetty option to explicitly set `max-threads` . Defaults to `undef` , so the
PuppetDB-Jetty default is used.
2014-06-26 17:15:34 +02:00
2014-08-04 13:06:07 +02:00
####`read_database`
2015-10-10 00:02:23 +02:00
Which database backend to use for the read database. Only supports
`postgres` (default). This option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_database_host`
2015-10-10 00:02:23 +02:00
*This parameter must be set to enable the PuppetDB read-database.*
2014-08-04 13:06:07 +02:00
2015-10-10 00:02:23 +02:00
The hostname or IP address of the read database server. Defaults to `undef` .
The default is to use the regular database for reads and writes. This option is
supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_database_port`
2015-10-10 00:02:23 +02:00
The port that the read database server listens on. Defaults to `5432` . This
option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_database_username`
2015-10-10 00:02:23 +02:00
The name of the read database user to connect as. Defaults to `puppetdb` . This
option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_database_password`
2015-10-10 00:02:23 +02:00
The password for the read database user. Defaults to `puppetdb` . This option is
supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_database_name`
2015-10-10 00:02:23 +02:00
The name of the read database instance to connect to. Defaults to `puppetdb` .
This option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_database_ssl`
2015-10-10 00:02:23 +02:00
If true, PuppetDB will use SSL to connect to the postgres read database
(defaults to false). Setting up proper trust- and keystores has to be managed
outside of the PuppetDB module. This option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_log_slow_statements`
2015-10-10 00:02:23 +02:00
This sets the number of seconds before an SQL query to the read database is
considered "slow." Slow SQL queries are logged as warnings, to assist in
debugging and tuning. Note PuppetDB does not interrupt slow queries; it simply
reports them after they complete.
2014-08-04 13:06:07 +02:00
2015-10-10 00:02:23 +02:00
The default value is 10 seconds. A value of 0 will disable logging of slow
queries. This option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_conn_max_age`
2015-10-10 00:02:23 +02:00
The maximum time (in minutes) for a pooled read database connection to remain
unused before it is closed off.
2014-08-04 13:06:07 +02:00
2014-08-04 14:02:40 +02:00
If not supplied, we default to 60 minutes. This option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_conn_keep_alive`
2015-10-10 00:02:23 +02:00
This sets the time (in minutes) for a read database connection to remain idle
before sending a test query to the DB. This is useful to prevent a DB from
timing out connections on its end.
2014-08-04 13:06:07 +02:00
2014-08-04 14:02:40 +02:00
If not supplied, we default to 45 minutes. This option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
####`read_conn_lifetime`
2015-10-10 00:02:23 +02:00
The maximum time (in minutes) a pooled read database connection should remain
open. Any connections older than this setting will be closed off. Connections
currently in use will not be affected until they are returned to the pool.
2014-08-04 13:06:07 +02:00
2015-10-10 00:02:23 +02:00
If not supplied, we won't terminate connections based on their age alone. This
option is supported in PuppetDB >= 1.6.
2014-08-04 13:06:07 +02:00
2014-10-07 16:06:54 +02:00
####`ssl_dir`
2014-06-26 17:15:34 +02:00
2015-10-10 00:02:23 +02:00
Base directory for PuppetDB SSL configuration. Defaults to `/etc/puppetdb/ssl`
or `/etc/puppetlabs/puppetdb/ssl` for FOSS and PE respectively.
2013-01-14 23:07:24 +01:00
2014-10-07 16:06:54 +02:00
####`ssl_set_cert_paths`
2013-01-14 23:07:24 +01:00
2015-10-10 00:02:23 +02:00
A switch to enable or disable the management of SSL certificates in your
`jetty.ini` configuration file.
2013-01-14 23:07:24 +01:00
2014-10-07 16:06:54 +02:00
####`ssl_cert_path`
2013-01-14 23:07:24 +01:00
2014-10-07 16:06:54 +02:00
Path to your SSL certificate for populating `jetty.ini` .
2013-01-14 23:07:24 +01:00
2014-10-07 16:06:54 +02:00
####`ssl_key_path`
Path to your SSL key for populating `jetty.ini` .
####`ssl_ca_cert_path`
Path to your SSL CA for populating `jetty.ini` .
####`ssl_deploy_certs`
2015-10-10 00:02:23 +02:00
A boolean switch to enable or disable the management of SSL keys in your
`ssl_dir` . Default is `false` .
2014-10-07 16:06:54 +02:00
####`ssl_key`
2013-01-14 23:07:24 +01:00
2014-10-07 16:06:54 +02:00
Contents of your SSL key, as a string.
####`ssl_cert`
Contents of your SSL certificate, as a string.
####`ssl_ca_cert`
Contents of your SSL CA certificate, as a string.
2015-01-05 11:16:32 +01:00
####`manage_firewall`
2015-10-10 00:02:23 +02:00
If `true` , puppet will manage your iptables rules for PuppetDB via the
[puppetlabs-firewall ](https://forge.puppetlabs.com/puppetlabs/firewall ) class.
2015-01-05 11:16:32 +01:00
2015-04-08 16:29:03 +02:00
####`command_threads`
2015-10-10 00:02:23 +02:00
The number of command processing threads to use. Defaults to `undef` , using the
PuppetDB built-in default.
2015-04-08 16:29:03 +02:00
####`store_usage`
2015-10-10 00:02:23 +02:00
The amount of disk space (in MB) to allow for persistent message storage.
Defaults to `undef` , using the PuppetDB built-in default.
2015-04-08 16:29:03 +02:00
####`temp_usage`
2015-10-10 00:02:23 +02:00
The amount of disk space (in MB) to allow for temporary message storage.
Defaults to `undef` , using the PuppetDB built-in default.
2015-04-08 16:29:03 +02:00
2015-10-14 13:05:45 +02:00
####`certificate_whitelist_file`
The name of the certificate whitelist file to set up and configure in PuppetDB. Defaults to `/etc/puppetdb/certificate-whitelist` or `/etc/puppetlabs/puppetdb/certificate-whitelist` for FOSS and PE respectively.
####`certificate_whitelist`
Array of the X.509 certificate Common Names of clients allowed to connect to PuppetDB. Defaults to empty. Be aware that this permits full access to all Puppet clients to download anything contained in PuppetDB, including the full catalogs of all nodes, which possibly contain sensitive information. Set to `[ $::servername ]` to allow access only from your (single) Puppet master, which is enough for normal operation. Set to a list of Puppet masters if you have multiple.
2014-10-07 16:06:54 +02:00
### puppetdb::server
2015-10-10 00:02:23 +02:00
The `puppetdb::server` class manages the PuppetDB server independently of the
underlying database that it depends on. It will manage the PuppetDB package,
service, config files, etc., but will still allow you to manage the database
(e.g. PostgreSQL) however you see fit.
2014-10-07 16:06:54 +02:00
class { 'puppetdb::server':
database_host => 'pg1.mydomain.com',
}
2013-01-14 23:07:24 +01:00
### puppetdb::master::config
2015-10-10 00:02:23 +02:00
The `puppetdb::master::config` class directs your Puppet master to use PuppetDB,
which means that this class should be used on your Puppet master node. It’ ll
verify that it can successfully communicate with your PuppetDB server, and then
configure your master to use PuppetDB.
2013-01-14 23:07:24 +01:00
2015-10-10 00:02:23 +02:00
Using this class allows the module to manipulate the puppet configuration files
puppet.conf and routes.yaml. The puppet.conf changes are supplemental and should
not affect any of your existing settings, but the routes.yaml file will be
overwritten entirely. If you have an existing routes.yaml file, you will want to
take care to use the `manage_routes` parameter of this class to prevent the module
from managing that file, and you’ ll need to manage it yourself.
2013-01-14 23:07:24 +01:00
class { 'puppetdb::master::config':
puppetdb_server => 'my.host.name',
puppetdb_port => 8081,
}
**Parameters within `puppetdb::master::config` :**
####`puppetdb_server`
2016-01-21 00:29:32 +01:00
The dns name or ip of the PuppetDB server. Defaults to the hostname of the
2015-10-10 00:02:23 +02:00
current node, i.e. `$::fqdn` .
2013-01-14 23:07:24 +01:00
####`puppetdb_port`
2015-10-10 00:02:23 +02:00
The port that the PuppetDB server is running on. Defaults to `8081` .
2013-01-14 23:07:24 +01:00
2014-10-06 14:25:43 +02:00
####`puppetdb_disable_ssl`
2015-10-10 00:02:23 +02:00
If true, use plain HTTP to talk to PuppetDB. Defaults to the value of
`disable_ssl` if PuppetDB is on the same server as the Puppet Master, or else
false. If you set this, you probably need to set `puppetdb_port` to match the HTTP
port of the PuppetDB.
2014-10-06 14:25:43 +02:00
2013-10-18 18:03:28 +02:00
####`puppetdb_soft_write_failure`
2015-10-10 00:02:23 +02:00
Boolean to fail in a soft manner if PuppetDB is not accessible for command
submission Defaults to `false` .
2013-10-18 18:03:28 +02:00
2013-01-14 23:07:24 +01:00
####`manage_routes`
2013-01-29 16:23:01 +01:00
2015-10-10 00:02:23 +02:00
If `true` , the module will overwrite the Puppet master's routes file to
configure it to use PuppetDB. Defaults to `true` .
2013-01-29 16:23:01 +01:00
2013-01-14 23:07:24 +01:00
####`manage_storeconfigs`
2015-10-10 00:02:23 +02:00
If `true` , the module will manage the Puppet master's storeconfig settings.
Defaults to `true` .
2013-01-14 23:07:24 +01:00
2013-05-24 21:48:34 +02:00
####`manage_report_processor`
2015-10-10 00:02:23 +02:00
If `true` , the module will manage the 'reports' field in the puppet.conf file to
enable or disable the PuppetDB report processor. Defaults to `false` .
2013-05-24 21:48:34 +02:00
2013-02-23 01:20:04 +01:00
####`manage_config`
2015-10-10 00:02:23 +02:00
If `true` , the module will store values from `puppetdb_server` and `puppetdb_port`
parameters in the PuppetDB configuration file. If `false` , an existing PuppetDB
configuration file will be used to retrieve server and port values.
2013-02-23 01:20:04 +01:00
####`strict_validation`
2015-10-10 00:02:23 +02:00
If `true` , the module will fail if PuppetDB is not reachable, otherwise it will
preconfigure PuppetDB without checking.
2013-02-23 01:20:04 +01:00
2013-05-24 21:48:34 +02:00
####`enable_reports`
2015-10-10 00:02:23 +02:00
Ignored unless `manage_report_processor` is `true` , in which case this setting
will determine whether or not the PuppetDB report processor is enabled (`true`)
or disabled (`false`) in the puppet.conf file.
2013-05-24 21:48:34 +02:00
2013-01-14 23:07:24 +01:00
####`puppet_confdir`
2015-10-10 00:02:23 +02:00
Puppet's config directory. Defaults to `/etc/puppet` .
2013-01-14 23:07:24 +01:00
####`puppet_conf`
2015-10-10 00:02:23 +02:00
Puppet's config file. Defaults to `/etc/puppet/puppet.conf` .
2013-01-14 23:07:24 +01:00
2015-01-15 10:13:51 +01:00
####`masterless`
2015-10-10 00:02:23 +02:00
A boolean switch to enable or disable the masterless setup of PuppetDB. Defaults
to `false` .
2015-01-15 10:13:51 +01:00
2013-10-21 17:21:12 +02:00
####`terminus_package`
2015-10-10 00:02:23 +02:00
Name of the package to use that represents the PuppetDB terminus code. Defaults
to `puppetdb-termini` , when `puppetdb_version` is set to `<= 2.3.x` the default
changes to `puppetdb-terminus` .
2013-10-21 17:21:12 +02:00
####`puppet_service_name`
2015-10-10 00:02:23 +02:00
Name of the service that represents Puppet. You can change this to `apache2` or
`httpd` depending on your operating system, if you plan on having Puppet run
using Apache/Passenger for example.
2013-10-21 17:21:12 +02:00
2013-01-14 23:07:24 +01:00
####`puppetdb_startup_timeout`
2015-10-10 00:02:23 +02:00
The maximum amount of time that the module should wait for PuppetDB to start up.
This is most important during the initial install of PuppetDB (defaults to 15
seconds).
2013-01-14 23:07:24 +01:00
####`restart_puppet`
2015-10-10 00:02:23 +02:00
If `true` , the module will restart the Puppet master when PuppetDB configuration
files are changed by the module. Defaults to `true` . If set to `false` , you
must restart the service manually in order to pick up changes to the config
files (other than `puppet.conf` ).
2013-01-14 23:07:24 +01:00
### puppetdb::database::postgresql
2015-10-10 00:02:23 +02:00
The `puppetdb::database::postgresql` class manages a PostgreSQL server for use
by PuppetDB. It can manage the PostgreSQL packages and service, as well as
creating and managing the PuppetDB database and database user accounts.
2013-01-14 23:07:24 +01:00
class { 'puppetdb::database::postgresql':
listen_addresses => 'my.postgres.host.name',
}
2013-10-21 17:21:12 +02:00
####`listen_addresses`
2015-10-10 00:02:23 +02:00
The `listen_address` is a comma-separated list of hostnames or IP addresses on
which the postgres server should listen for incoming connections. This defaults
to `localhost` . This parameter maps directly to PostgreSQL's `listen_addresses`
config option. Use a `*` to allow connections on any accessible address.
2013-10-21 17:21:12 +02:00
####`database_name`
Sets the name of the database. Defaults to `puppetdb` .
####`database_username`
Creates a user for access the database. Defaults to `puppetdb` .
####`database_password`
Sets the password for the database user above. Defaults to `puppetdb` .
2013-05-06 11:07:37 +02:00
2014-02-20 21:35:16 +01:00
####`manage_server`
2015-10-10 00:02:23 +02:00
Conditionally manages the PostgreSQL server via `postgresql::server` . Defaults
to `true` . If set to `false` , this class will create the database and user via
`postgresql::server::db` but not attempt to install or manage the server itself.
2014-02-20 21:35:16 +01:00
2014-10-07 16:06:54 +02:00
####`test_url`
2015-10-10 00:02:23 +02:00
The URL to use for testing if the PuppetDB instance is running. Defaults to
`/pdb/meta/v1/version` .
2014-10-07 16:06:54 +02:00
2015-01-28 16:32:31 +01:00
####`manage_package_repo`
2015-10-10 00:02:23 +02:00
If `true` , the official postgresql.org repo will be added and postgres won't
be installed from the regular repository. Defaults to `true` .
2015-01-28 16:32:31 +01:00
####`postgres_version`
2015-10-10 00:02:23 +02:00
If the postgresql.org repo is installed, you can install several versions of
postgres. Defaults to `9.4` , the latest stable version.
2015-01-28 16:32:31 +01:00
2013-01-14 23:07:24 +01:00
Implementation
---------------
### Resource overview
In addition to the classes and variables mentioned above, PuppetDB includes:
**puppetdb::master::routes**
2015-10-10 00:02:23 +02:00
Configures the Puppet master to use PuppetDB as the facts terminus. *WARNING* :
the current implementation simply overwrites your routes.yaml file; if you have
an existing routes.yaml file that you are using for other purposes, you should
*not* use this.
2013-01-14 23:07:24 +01:00
class { 'puppetdb::master::routes':
puppet_confdir => '/etc/puppet'
}
2015-10-10 00:02:23 +02:00
The optional parameter routes can be used to specify a custom route
configuration. For example to configure routes for masterless puppet.
2014-05-14 14:06:48 +02:00
class { 'puppetdb::master::routes':
routes => {
'apply' => {
'facts' => {
'terminus' => 'facter',
'cache' => 'puppetdb_apply',
}
}
}
}
2013-01-14 23:07:24 +01:00
**puppetdb::master::storeconfigs**
2015-10-10 00:02:23 +02:00
Configures the Puppet master to enable storeconfigs and to use PuppetDB as the
storeconfigs backend.
2013-01-14 23:07:24 +01:00
class { 'puppetdb::master::storeconfigs':
puppet_conf => '/etc/puppet/puppet.conf'
}
**puppetdb::server::validate_db**
2015-10-10 00:02:23 +02:00
Validates that a successful database connection can be established between the
node on which this resource is run and the specified PuppetDB database instance
(host/port/user/password/database name).
2013-01-14 23:07:24 +01:00
puppetdb::server::validate_db { 'validate my puppetdb database connection':
database_host => 'my.postgres.host',
database_username => 'mydbuser',
database_password => 'mydbpassword',
database_name => 'mydbname',
}
2012-09-19 00:59:44 +02:00
2013-01-14 23:07:24 +01:00
### Custom Types
2012-09-19 00:59:44 +02:00
2013-01-14 23:07:24 +01:00
**puppetdb_conn_validator**
2012-09-18 23:32:34 +02:00
2015-10-10 00:02:23 +02:00
Verifies that a connection can be successfully established between a node and
the PuppetDB server. Its primary use is as a precondition to prevent
configuration changes from being applied if the PuppetDB server cannot be
reached, but it could potentially be used for other purposes such as monitoring.
2012-09-18 23:32:34 +02:00
2013-01-14 23:07:24 +01:00
Limitations
------------
2012-09-18 23:32:34 +02:00
2013-01-29 16:23:01 +01:00
Currently, PuppetDB is compatible with:
2012-09-18 23:32:34 +02:00
2014-09-16 16:14:58 +02:00
Puppet Version: 3.7.1+
2012-09-18 23:32:34 +02:00
2013-01-29 16:23:01 +01:00
Platforms:
2014-09-16 16:14:58 +02:00
* EL 5, 6, 7
* Debian 6, 7
* Ubuntu 10.04, 12.04, 14.04
Community Maintained Platforms:
2013-08-19 22:10:41 +02:00
* Archlinux
2014-08-31 22:41:39 +02:00
* OpenBSD 5.6-current and newer
2014-09-16 16:14:58 +02:00
* SLES 11 SP1
2012-09-18 23:32:34 +02:00
2013-01-14 23:07:24 +01:00
Development
------------
2012-09-18 23:32:34 +02:00
2015-10-10 00:02:23 +02:00
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 of hardware, software, and deployment
configurations that Puppet is intended to serve.
2012-09-18 23:32:34 +02:00
2015-10-10 00:02:23 +02:00
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.
2012-09-18 23:32:34 +02:00
2015-10-10 00:02:23 +02:00
You can read the complete contribution guide
[on the Puppet Labs documentation website ](https://docs.puppetlabs.com/contribute.html )