Forge Home

confd

confd class and functions

11,864 downloads

9,584 latest version

4.6 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.2.3 (latest)
  • 0.2.2
  • 0.2.1
  • 0.2.0
  • 0.1.0
released Jun 4th 2015
This version is compatible with:
  • , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'ajcrowe-confd', '0.2.3'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add ajcrowe-confd
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install ajcrowe-confd --version 0.2.3

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: etcd, consul, confd, toml

Documentation

ajcrowe/confd — version 0.2.3 Jun 4th 2015

Puppet Confd

Puppet Forge Build Status

  1. Overview
  2. Setup
  3. Examples
  4. Development

##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.