Skip to content

Commit

Permalink
Merge pull request #134 from alexjfisher/configure_lookup_options_in_…
Browse files Browse the repository at this point in the history
…hiera

Move lookup_options to hiera
  • Loading branch information
bastelfreak authored Dec 20, 2019
2 parents 9d224ae + bd79dfe commit d0277a6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
6 changes: 6 additions & 0 deletions data/defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
lookup_options:
'telegraf::inputs':
merge: 'deep'
'telegraf::outputs':
merge: 'deep'
10 changes: 10 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
version: 5

defaults:
datadir: 'data'
data_hash: yaml_data

hierarchy:
- name: 'defaults'
path: 'defaults.yaml'
11 changes: 0 additions & 11 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,6 @@
$service_hasstatus = $telegraf::params::service_hasstatus
$service_restart = $telegraf::params::service_restart

$_outputs = lookup({
name => 'telegraf::outputs',
default_value => $outputs,
merge => deep,
})
$_inputs = lookup({
name => 'telegraf::inputs',
default_value => $inputs,
merge => deep,
})

contain telegraf::install
contain telegraf::config
contain telegraf::service
Expand Down
8 changes: 2 additions & 6 deletions templates/telegraf.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@
debug = <%= @debug %>
quiet = <%= @quiet %>

<% if @_outputs -%>
#
# OUTPUTS:
#
<%= require 'toml-rb'; TomlRB.dump({'outputs'=>@_outputs}) %>
<% end -%>
<%= require 'toml-rb'; TomlRB.dump({'outputs'=>@outputs}) %>

<% if @_inputs -%>
#
# INPUTS:
#
<%= require 'toml-rb'; TomlRB.dump({'inputs'=>@_inputs}) %>
<% end -%>
<%= require 'toml-rb'; TomlRB.dump({'inputs'=>@inputs}) %>

0 comments on commit d0277a6

Please sign in to comment.