GithubHelp home page GithubHelp logo

isabella232 / puppet-confd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from atlassian/puppet-confd

0.0 0.0 0.0 48 KB

Puppet module for managing confd

License: MIT License

Ruby 36.68% Puppet 37.37% HTML 11.72% Shell 14.23%

puppet-confd's Introduction

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.

puppet-confd's People

Contributors

cwood avatar gozer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.