FYI this is how I ended up doing my logstash config module.  It works but
the content is not in Hiera we have flat files we manage.

 $logstash_configs = [
      'app1',
      'app2',
      'app3',
    ]

    logstash::configfile { "Banner":
        source => "puppet:///modules/company/logstash/banner",
        order  => 1
      }

    $logstash_configs.each |$my_conf| {
      logstash::configfile { "${my_conf}_input":
        source =>
"puppet:///modules/company/logstash/decc/${my_conf}_input_file",
        order  => 10
      }
      logstash::configfile { "${my_conf}__unfiltered":
        source =>
"puppet:///modules/company/logstash/decc/${my_conf}_unfiltered_filter",
        order  => 20
      }
      logstash::configfile { "${my_conf}_filter":
        source =>
"puppet:///modules/company/logstash/decc/${my_conf}_filter",
        order  => 30
      }
    }
    logstash::configfile { 'output':
      source =>
'puppet:///modules/company/logstash/output_elasticsearch_http',
      order  => 100
    }



On Thu, May 29, 2014 at 11:05 AM, Doug Forster <[email protected]> wrote:

> Just a thought try changing
>   $shipper_config = hiera('profiles::logstash::config', {}) =>
> $shipper_config = hiera_hash('profiles::logstash::config', {})
>
>
> On Thu, May 29, 2014 at 11:01 AM, Brian Wilkins <[email protected]>wrote:
>
>> It prints out:
>>
>> order10contentthis is a test
>>
>> It concatenated it all together.
>>
>>
>>
>> On Thursday, May 29, 2014 12:59:09 PM UTC-4, Doug_F wrote:
>>
>>> Try setting your notice("${shipper_config}") before create resources and
>>> see what it prints out.
>>>
>>>
>>> On Thu, May 29, 2014 at 10:47 AM, Brian Wilkins <[email protected]>wrote:
>>>
>>>> Oh ok, makes sense. I did that and now I get "can't convert String into
>>>> Hash at /etc/puppet/modules/profiles/manifests/logstash/shipper.pp:15"
>>>>
>>>> My shipper.pp
>>>>
>>>> class profiles::logstash::shipper() {
>>>>
>>>>   $shipper_config = hiera('profiles::logstash::config', {})
>>>>   create_resources('profiles::logstash::config', $shipper_config)
>>>>
>>>>
>>>>   notice("${shipper_config[name]}")
>>>>   class { 'logstash':
>>>>     ensure  => 'present',
>>>>     version => '1.4.1-1_bd507eb',
>>>>     status  => 'enabled',
>>>>   }
>>>>
>>>>   profiles::logstash::config { 'shipper':
>>>>
>>>>        content => $content,
>>>>        order   => $order,
>>>>   }
>>>>
>>>>   include logstash
>>>> }
>>>>
>>>> Line 15 is the create_resources line.
>>>>
>>>>
>>>> On Thursday, May 29, 2014 12:42:15 PM UTC-4, Doug_F wrote:
>>>>
>>>>> profiles::logstash::config:
>>>>>    input_file:
>>>>>      content: 'this is a test'
>>>>>      order: '10'
>>>>>
>>>>> Should probably be
>>>>> profiles::logstash::config:
>>>>>    content: 'this is a test'
>>>>>    order: '10'
>>>>>
>>>>>
>>>>>
>>>>> On Thu, May 29, 2014 at 10:27 AM, Brian Wilkins <[email protected]>wrote:
>>>>>
>>>>>> I am trying to use hiera to populate a defined type to feed the
>>>>>> puppet-logstash module. So far, I have been unable to send the data from 
>>>>>> my
>>>>>> hiera file to my defined type. I have tested my defined type and it is
>>>>>> working, I just can't seem to populate the variables. It tells me that
>>>>>> $content and $order are not set.
>>>>>>
>>>>>> /etc/puppet/modules/profiles/manifests/logstash/shipper.pp:
>>>>>>
>>>>>> class profiles::logstash::shipper() {
>>>>>>
>>>>>>   $shipper_config = hiera('profiles::logstash::config')
>>>>>>   create_resources('config', $shipper_config)
>>>>>>
>>>>>>   notice("${shipper_config[name]}")
>>>>>>   class { 'logstash':
>>>>>>     ensure  => 'present',
>>>>>>     version => '1.4.1-1_bd507eb',
>>>>>>     status  => 'enabled',
>>>>>>   }
>>>>>>
>>>>>>   profiles::logstash::config { $name:
>>>>>>        content => $content,
>>>>>>        order   => $order,
>>>>>>   }
>>>>>>
>>>>>>   include logstash
>>>>>> }
>>>>>>
>>>>>> /etc/puppet/modules/profiles/manifests/logstash/config.pp:
>>>>>>
>>>>>> define profiles::logstash::config(
>>>>>>   $content = undef,
>>>>>>   $order = undef,
>>>>>> ) {
>>>>>>   logstash::configfile { $name:
>>>>>>     content => $content,
>>>>>>     order   => $order
>>>>>>   }
>>>>>> }
>>>>>>
>>>>>> /etc/puppet/data/node/els4172.els.dev.yaml:
>>>>>>
>>>>>> classes:
>>>>>>   - os::repo
>>>>>>   - profiles::logstash::shipper
>>>>>>
>>>>>> profiles::logstash::config:
>>>>>>    input_file:
>>>>>>      content: 'this is a test'
>>>>>>      order: '10'
>>>>>>
>>>>>>
>>>>>> My notice is not called, it does not display a thing. Did I use
>>>>>> create_resources correctly?
>>>>>>
>>>>>>
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Puppet Users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>>
>>>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>>>> msgid/puppet-users/c162ac6e-257c-4c42-a856-0b2f99dbd7f3%40goog
>>>>>> legroups.com<https://groups.google.com/d/msgid/puppet-users/c162ac6e-257c-4c42-a856-0b2f99dbd7f3%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Puppet Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/puppet-users/305d7707-68ca-4814-940e-ef984fcb2c04%
>>>> 40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/305d7707-68ca-4814-940e-ef984fcb2c04%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-users/09cd7ee2-7231-499f-a05e-e4430389956a%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/09cd7ee2-7231-499f-a05e-e4430389956a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAOwhAcoROXisRxY5X3zVi%3DPk%3DF740uW%2B9A_EMB5%2B2rNnHVDbtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to