On Thursday, July 11, 2013 4:21:18 AM UTC-5, [email protected] wrote:
>
>
>
> On Thursday, July 11, 2013 10:17:47 AM UTC+1, Paul Tötterman wrote:
>>
>>
>> What I want Puppet to do is to "loop" through this list of potential
>>> kernels and install a specific driver package for all possibilities.
>>> Is this even possible without a custom provider ?
>>>
>>
>> I doubt it, unless you also export a installed_kernel_count => 3 fact.
>>
>>
> Thanks as luck we have it we do as part of the custom fact
>
> installed_kernel_count => 3
>
>
Step one: create an array of the desired resource titles, of some other
suitable identifiers of the target resource, or of something you can
transform into the same. To do this without writing a custom function, you
probably need to create a list of the titles in string form via
inline_template(), then split() it.
Step two: use the array of titles to declare the desired resources.
Details depend on your exact needs: maybe you can just declare packages,
but you can also declare instances of a defined type.
That might come together something like this:
class site::kernel_dirvers {
$kernel_fact_stem = 'installed_kernel'
$kernel_list = inline_template("<%=
(0...@installed_kernel_count.to_i).collect{|n| @kernel_fact_stem +
n.to_s}.join(',') %>")
$kernels = split($kernel_list, ',')
site::my_kernel_driver { $kernels: }
}
define site::my_kernel_driver () {
$driver_title = "mykod-${title}"
# ensure the selected driver present,
# maybe something like this:
package { $driver_title: ensure => latest }
}
John
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.