Solved it using this tip.. it's odd but it works: 
http://serverfault.com/a/538877/26514

shipper.pp

class profiles::logstash::shipper() {

  $shipper_array = hiera_array('profiles::logstash::config_array')

  define hash_extract() {
    $shipper_hash = hiera_hash('profiles::logstash::config_settings')
    $shipper_config = $shipper_hash[$name]

    profiles::logstash::config {'shipper':
       content => $shipper_config['content'],
       order   => $shipper_config['order'],
    }
    notice($shipper_config['content'])
    notice($shipper_config['order'])
  }

  hash_extract{$shipper_array:}

  class { 'logstash':
    ensure  => 'present',
    version => '1.4.1-1_bd507eb',
    status  => 'enabled',
  }
  include logstash
}


And in my hostname.yaml:

classes:
  - os::repo
  - profiles::logstash::shipper

profiles::logstash::config_array:
  - inputfile

profiles::logstash::config_settings:
  inputfile:
    content: 'this is a test'
    order: '10'


On Thursday, May 29, 2014 2:37:31 PM UTC-4, Brian Wilkins wrote:
>
> Yep!
>
> $ sudo hiera --debug profiles::logstash::config_settings ::fqdn=hostname
>
> DEBUG: Thu May 29 14:24:29 -0400 2014: Hiera YAML backend starting
> DEBUG: Thu May 29 14:24:29 -0400 2014: Looking up 
> profiles::logstash::config_settings in YAML backend
> DEBUG: Thu May 29 14:24:29 -0400 2014: Looking for data source 
> node/hostname
> DEBUG: Thu May 29 14:24:29 -0400 2014: Found 
> profiles::logstash::config_settings in node/hostname
> {"input_file"=>{"content"=>"this is a test", "order"=>"10"}}
>
>
> On Thursday, May 29, 2014 2:12:32 PM UTC-4, Doug_F wrote:
>>
>> Does it show up properly if you lookup on the server?
>>
>>
>> On Thu, May 29, 2014 at 12:09 PM, Brian Wilkins <[email protected]>wrote:
>>
>>> Hmm, that's not working either. Doesn't look like it is populating my 
>>> define now. Hmm
>>>
>>>
>>> On Thursday, May 29, 2014 1:56:43 PM UTC-4, Doug_F wrote:
>>>
>>>> I think I figured out what was wrong. Dynamic data bindings may be 
>>>> mapping the inputs to the profiles::logstash::config defined type. Also I 
>>>> was in error in modifying your hiera data. 
>>>>
>>>> Try this: 
>>>>
>>>> create_resources('profiles::logstash::config', hiera_hash('profiles::
>>>> logstash::config_settings'))
>>>>
>>>> In Hiera:
>>>> profiles::logstash::config_settings:
>>>>    input_file:
>>>>      content: 'this is a test'
>>>>      order: '10'
>>>>
>>>> Add a notice line in your profiles::logstash::config type to:
>>>> notify("name is ${name}") 
>>>> notify("content is ${content}") 
>>>> notify("order is ${order}") 
>>>>
>>>>
>>>> On Thu, May 29, 2014 at 11:25 AM, Brian Wilkins <[email protected]>wrote:
>>>>
>>>>> Same problem. It seems like I am close. If only it didn't put all the 
>>>>> data together as one string.
>>>>>
>>>>>
>>>>> On Thursday, May 29, 2014 1:17:07 PM UTC-4, Doug_F wrote:
>>>>>
>>>>>> Maybe try your hiera command right inside your create_resources. 
>>>>>>
>>>>>>
>>>>>> On Thu, May 29, 2014 at 11:13 AM, Brian Wilkins <[email protected]>wrote:
>>>>>>
>>>>>>> On puppetmaster:
>>>>>>>
>>>>>>> $ sudo hiera --debug profiles::logstash::config ::fqdn=hostname
>>>>>>>
>>>>>>> DEBUG: Thu May 29 13:12:56 -0400 2014: Hiera YAML backend starting
>>>>>>> DEBUG: Thu May 29 13:12:56 -0400 2014: Looking up 
>>>>>>> profiles::logstash::config in YAML backend
>>>>>>> DEBUG: Thu May 29 13:12:56 -0400 2014: Looking for data source 
>>>>>>> node/hostname
>>>>>>> DEBUG: Thu May 29 13:12:56 -0400 2014: Found 
>>>>>>> profiles::logstash::config in node/hostname
>>>>>>> {"order"=>"10", "content"=>"this is a test"}
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Thursday, May 29, 2014 1:11:20 PM UTC-4, Doug_F wrote:
>>>>>>>
>>>>>>>> If you use hiera on the server does it show up as a hash? 
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, May 29, 2014 at 11:08 AM, Brian Wilkins 
>>>>>>>> <[email protected]>wrote:
>>>>>>>>
>>>>>>>>> Same problem. I see it concatenated in the notice.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thursday, May 29, 2014 1:05:39 PM UTC-4, Doug_F 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/m
>>>>>>>>>>>>> anifests/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%40googlegroups.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/b519938d-da64
>>>>>>>>> -4674-8e6e-b98db1dcb9d4%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/b519938d-da64-4674-8e6e-b98db1dcb9d4%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/f9ece3eb-03cd
>>>>>>> -4a21-8dd1-30170127c83e%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/f9ece3eb-03cd-4a21-8dd1-30170127c83e%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/ddff314a-d5e5-4f81-8e26-6eb63b665521%
>>>>> 40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/ddff314a-d5e5-4f81-8e26-6eb63b665521%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/03325a33-6c90-46d6-8fe1-928456930478%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/03325a33-6c90-46d6-8fe1-928456930478%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/565c1f2c-2a78-4e62-9835-74f8172ca3ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to