Version information
This version is compatible with:
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'ajcrowe-confd', '0.2.3'
Learn more about managing modules with a PuppetfileDocumentation
Puppet Confd
##Overview
This module allow you to manage your confd templates and resources in Puppet. All configuration options are available and can be defined in Hiera
This module will install, configure and manage your resources and templates.
##Setup
Once you have this module installed you'll need a site module to store your templates and ssl certficates (if you're using them).
It should have the following structure:
site_confd
└── files
├── confd-0.5.0
├── confd-x.x.x
├── confd-latest -> confd-0.5.0
├── ssl
│ ├── ssl.crt
│ └── ssl.key
└── templates
├── resource1.tmpl
├── resource2.tmpl
└── ...
You'll need to download the confd binary of you choice and ensure it matches confd-$version
, the default value for version is latest. This allows you to run multiple versions of confd should you wish, can you symlink the default to confd-latest
.
You can also customise the name of site module by setting the confd::sitemodule
param.
To setup confd with all defaults you can simply include the class
include confd
This will copy the confd
binary and create all required the directory structure and sync your assets from the site module.
###The confd class
####Parameters
These params are available to the confd class:
#####version
Integer: defaults to latest
Description: This sets the confd binary to be installed from the site module
#####installdir
Absolute path: defaults to /usr/local/bin
for Debian and /usr/bin
for RedHat/Amazon
Description: This set where the confd binary will be stored
#####sitemodule
String: defaults to site_confd
Description: Specifies the name of the site module for templates, ssl certs and binaries
#####confdir
Absolute path: defaults to /etc/confd/
Description: Specifies where all the configuration for confd will live
Other Parameters
All other parameters are directly mapped to the configuration in confd.toml
please see the documentation for full details.
###The confd resource define
####Parameters
Please see the confd documentation for the available parameters, they are mapped directly and have validation checks based on the types.
##Examples
###Install confd with etcd backend and define a resource
class { 'confd':
nodes => [ 'etcd-1:4001', 'etcd-2:4001' ],
interval => 10
prefix => '/confd'
}
confd::resource { 'nginx_upstream_01':
dest => '/etc/nginx/conf.d/upstream_01.conf',
src => 'nginx_upstream.tmpl',
keys => [ '/nginx/upstream/01' ],
group => 'root',
owner => 'root',
mode => 0644,
check_cmd => '/usr/sbin/nginx -t',
reload_cmd => '/usr/sbin/nginx -s reload'
}
The src
value in the resource will be looking for a template in /etc/confd/templates/nginx_upstream.tmpl
so this will need to exist in the sites module under files/templates/nginx_upstream.tmpl
###Hiera resource lookup
You can also define your resources in hiera under the variable confd::resources
and these will automatically be created when the confd
class is instantiated.
####Example JSON hiera:
"confd::resources": {
"nginx_upstream_01": {
"dest": "/etc/nginx/conf.d/upstream_01.conf",
"src": "nginx_upstream.tmpl",
"keys": [
"/nginx/upstream/01"
],
"group": "root",
"owner": "root",
"mode": "0644",
"check_cmd": "/usr/sbin/nginx -t",
"reload_cmd": "/usr/sbin/nginx -s reload"
},
"nginx_upstream_02": {
"dest": "/etc/nginx/conf.d/upstream_02.conf",
"src": "nginx_upstream.tmpl",
"keys": [
"/nginx/upstream/02"
],
"group": "root",
"owner": "root",
"mode": "0644",
"check_cmd": "/usr/sbin/nginx -t",
"reload_cmd": "/usr/sbin/nginx -s reload"
}
}
Development
If you have suggestions or improvements please file an issue or submit as pull request, i'll try and sort them as quickly as possble.
If you submit a pull please try and include tests for the new functionality/fix. The module is tested with Travis-CI.
2015-06-04 - v0.2.3
- Added new supported backends to regex
- Added 'log-level' option, if set 'debug', 'verbose' and 'quiet' will omitted from confd.toml
- Added missing 'client_cakeys' option to configuration file
2015-03-20 - v0.2.2
- Bug fix in template for confd.toml for client_key, thanks to @paalmoest for the fix
2015-02-10 - v0.2.1
- Fixed missing 'backend' setting in template
- Added watch param
- Removed unneeded '[confd]' header from 'confd.toml'
All these fixes were contributed by @gozer, many thanks
2014-12-13 - v0.2.0
- Updated to work with 0.6/0.7
- This is backward incompatible with previous confd releases (anything below 0.6).
- Please continue to use 'v0.1.0' if you're confd is lower than version '0.6'
2014-09-03 - v0.1.0
- First working release
- All confd params and options mapped and validated
2014-08-28 - v0.0.9
- pre-release
Dependencies
- puppetlabs/stdlib (>= 4.1.0)
The MIT License (MIT) Copyright (c) 2014 Alex Crowe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.