Skip to content

Commit

Permalink
Merge pull request #33 from raffraffraff/master
Browse files Browse the repository at this point in the history
Adding support for the consul-template 'max-stale' parameter
  • Loading branch information
gdhbashton committed Oct 9, 2015
2 parents d76c1f6 + 7a43825 commit 71f7eae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
10 changes: 6 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ set to 'package', its installed using the system package manager.
- `consul_token` Default: ''. ACL token to use when querying consul
- `consul_retry` Default: 10s. Time in seconds to wait before retrying consul requests
- `consul_wait` Default: undef. Min:Max time to wait before consul-template renders a new template to disk and triggers refresh. Specified in the format min:max according to [Go time duration format](http://golang.org/pkg/time/#ParseDuration)
- `consul_max_stale` Default: undef. The maximum staleness of a query. If specified, Consul will distribute work among all servers instead of just the leader.
- `init_style` Init style to use for consul-template service.
- `log_level` Default: info. Logging level to use for consul-template service. Can be 'debug', 'warn', 'err', 'info'

Expand All @@ -46,10 +47,11 @@ include consul_template
Or to specify parameters:
```puppet
class { 'consul_template':
service_enable => false
log_level => 'debug',
init_style => 'upstart',
consul_wait => '5s:30s'
service_enable => false
log_level => 'debug',
init_style => 'upstart',
consul_wait => '5s:30s',
consul_max_stale => '1s'
}
```

Expand Down
17 changes: 13 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,37 @@
}
}

# Set max-stale param if specified
if $::consul_template::consul_max_stale {
concat::fragment { 'consul_max_stale':
target => 'consul-template/config.json',
content => inline_template("max-stale = \"${::consul_template::consul_max_stale}\"\n\n"),
order => '03',
}
}

if $::consul_template::vault_enabled {
concat::fragment { 'vault-base':
target => 'consul-template/config.json',
content => inline_template("vault {\n address = \"${::consul_template::vault_address}\"\n token = \"${::consul_template::vault_token}\"\n"),
order => '03',
order => '04',
}
if $::consul_template::vault_ssl {
concat::fragment { 'vault-ssl1':
target => 'consul-template/config.json',
content => inline_template(" ssl {\n enabled = true\n verify = ${::consul_template::vault_ssl_verify}\n"),
order => '04',
order => '05',
}
concat::fragment { 'vault-ssl2':
target => 'consul-template/config.json',
content => inline_template(" cert = \"${::consul_template::vault_ssl_cert}\"\n ca_cert = \"${::consul_template::vault_ssl_ca_cert}\"\n }\n"),
order => '05',
order => '06',
}
}
concat::fragment { 'vault-baseclose':
target => 'consul-template/config.json',
content => "}\n\n",
order => '06',
order => '07',
}
}

Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
$consul_token = '',
$consul_retry = '10s',
$consul_wait = undef,
$consul_max_stale = undef,
$init_style = $consul_template::params::init_style,
$log_level = $consul_template::params::log_level,
$vault_enabled = false,
Expand Down

0 comments on commit 71f7eae

Please sign in to comment.