Forge Home

consul_watch

Sets up consul watch for invoking puppet agent when consul artifact_url changes

8,942 downloads

6,610 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.

Version information

  • 1.1.5 (latest)
  • 1.1.4
  • 1.1.3
  • 1.1.2
  • 1.1.1
  • 1.0.9
  • 1.0.8
  • 1.0.7
  • 1.0.6
  • 1.0.5
  • 1.0.2
  • 1.0.1
  • 1.0.0
released Dec 23rd 2016
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 'induja-consul_watch', '1.1.5'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add induja-consul_watch
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install induja-consul_watch --version 1.1.5

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

Documentation

induja/consul_watch — version 1.1.5 Dec 23rd 2016

consul_watch

Table of Contents

  1. Description
  2. Setup - The basics of getting started with consul_watch
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

This module creates a service for consul watch and triggers a puppet agent run if the key changes. This has been tested with rspec-puppet tests and is a working solution.

This module will come in handy if you have Jenkins pipeline writing to the consul, puppet agent nodes doesn't have to wait for 30 minutes for identifying that the consul key for the deployment piece has changed. Since the consul watch is set up, the moment the artifact war location changes in consul, it kicks off a puppet agent run in the node in which the watch service is running and your app gets deployed instantly.

This enables faster turn over of App deployment and testing for the developers.

Setup

This sets up a service that runs in the background called consul_watch.

What consul_watch affects

This executes a puppet agent run if the key in consul that you look for changes.

This depends on consul so it it a pre-requisite that you have consul already installed on the node that you are testing this.

This also depends on puppet agent being set up and is up and running.

Consul should be set up with key value pairs for setting up the consul watch.

Setup Requirements

Setup Consul

Setup Puppet agent

Setup artifact_url key in consul

Pass appropriate parameters for $war_url, $admin_path, $admin_bin_path otherwise the defaults will apply. See module manifests for comments on how to set them.

Beginning with consul_watch

Steps:

 1) Create a file resource for directory, /opt/continuous_delivery/bin
 2) Enter a value in artifact_url. 
 3) Do a sudo tail -f /var/log/messages to monitor the puppet agent run information.
 4) Edit the artifact_url to point to a different URL. Now the log should show that the consul watch triggered a puppet agent run.

Note: deploy_path in the class denotes the path to the App in Consul - example: Continuous-Deployment/war_url

Usage

class { 'consul_watch' :
  war_url        => 'Continuous-Deployment/war_url',
  admin_path     => '/opt/continuous_delivery',
  admin_bin_path => '/opt/continuous_delivery/bin',
}

You can customize the lookup for consul key based on how you've set yours up.

Reference

https://www.consul.io/docs/commands/watch.html

Limitations

Tested on Centos 6,7 and RHEL 6 & 7 nodes.

Development

Open to refactoring. Send in your PR and I shall get that added should that add more value to the module.

Release Notes/Contributors/Etc.