Check out defined types. For a faked together example:

define make_it_so::make_one_thing_so {
  cron { $title:
    command => "/path/$title",
    user    => 'deploy',
    hour    => '*/4',
    minute  => '0',
  }
}

http://docs.puppetlabs.com/learning/definedtypes.html


Then add a data structure which you will presumably retrieve from hiera:

$scripts = {
  'a.rb' => {},
  'b.rb' => {},
}

http://docs.puppetlabs.com/hiera/1/


Then use create_resources to make as many of these as you need, without putting 
arrays or hashes in your puppet code ($scripts here will be automatically 
looked up via hiera):

class make_it_so (
  $scripts = {}
) {
  create_resources('make_it_so::make_one_thing_so', $scripts)
}

http://docs.puppetlabs.com/references/latest/function.html#createresources




On Wed, Apr 02, 2014 at 03:03:42PM -0700, Joaquin Menchaca wrote:
>    Is there a way to do something like this:
> 
>    class make_it_so {
>      $scripts = ["a.rb", "b.rb"]
> 
>      cron { $scripts:
>        command     => "/path/$scripts",
>        user        => 'deploy',
>        hour        => '*/4',
>        minute      => '0',
>      }
> 
>    }
> 
>    The attribute usage of the array will just take the entire array
>    concatenated together. :'(
> 
>    I would like to have each resource declaration have a correspond to a
>    matching element of the array
> 
>    I would like the attribute with $scripts to match to the iteration of the
>    resource declaration $scripts.
> 
>    --
>    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 [1][email protected].
>    To view this discussion on the web visit
>    
> [2]https://groups.google.com/d/msgid/puppet-users/6db6cb93-e9c4-4a42-91e7-36aa7583b5e1%40googlegroups.com.
>    For more options, visit [3]https://groups.google.com/d/optout.
> 
> References
> 
>    Visible links
>    1. mailto:[email protected]
>    2. 
> https://groups.google.com/d/msgid/puppet-users/6db6cb93-e9c4-4a42-91e7-36aa7583b5e1%40googlegroups.com?utm_medium=email&utm_source=footer
>    3. 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/20140402230704.GA18603%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to