OK, I have a collection of related classes --
main_class_foo::subclass_one
main_class_foo::subclass_two
... etc
And each subclass has parameters,
class main_class_foo::subclass_one ( $parameter_one_a, $parameter_one_b ) { ...
}
class main_class_foo::subclass_two ( $parameter_two_a, $parameter_two_b ) { ...
}
so can I make a hiera file like this:
main_class_foo:
subclass_one:
parameter_one_a: this
parameter_one_b: that
subclass_two:
parameter_two_a: other
parameter_two_b: whatever
...and then load it with create_resources and instantiate it with an empty
spaceship operator like this:
$main_class_stuff = hiera_hash ( ''main_class_foo'' )
create resources (main_class_foo, $main_class_stuff )
Is that correct ?
“Sometimes I think the surest sign that intelligent life exists elsewhere in the
universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)
--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
I don''t see your spaceship, but that aside, I believe that your create resources call will try to instantiate two main_class_foo classes, named subclass_one and subclass_two, with the listed parameters. I don''t think you can use create_resources to instantiate different kinds of classes. On Monday, February 11, 2013 11:41:33 AM UTC-8, Ygor wrote:> > OK, I have a collection of related classes -- > > main_class_foo::subclass_one > main_class_foo::subclass_two > ... etc > > And each subclass has parameters, > > class main_class_foo::subclass_one ( $parameter_one_a, $parameter_one_b ) > { ... } > class main_class_foo::subclass_two ( $parameter_two_a, $parameter_two_b ) > { ... } > > > so can I make a hiera file like this: > > > main_class_foo: > subclass_one: > parameter_one_a: this > parameter_one_b: that > subclass_two: > parameter_two_a: other > parameter_two_b: whatever > > ...and then load it with create_resources and instantiate it with an empty > spaceship operator like this: > > $main_class_stuff = hiera_hash ( ''main_class_foo'' ) > create resources (main_class_foo, $main_class_stuff ) > > Is that correct ? > > “Sometimes I think the surest sign that intelligent life exists elsewhere > in the universe is that none of it has tried to contact us.” > Bill Waterson (Calvin & Hobbes) > >-- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
OK. Lets try it like this:
<whatever>.pp
-------------------------
class main_class_foo::subclass_one (
$parameter_one_a,
$parameter_one_b
) {
...
}
class main_class_foo::subclass_two (
$parameter_two_a,
$parameter_two_b
) {
...
}
-------------------------
<whatever>.yaml
-------------------------
main_class_foo:
subclass_one:
parameter_one_a: this
parameter_one_b: that
subclass_two:
parameter_two_a: other
parameter_two_b: whatever
-------------------------
<another-whatever>.pp
-------------------------
$main_class_stuff = hiera_hash ( ''main_class_foo'' )
create resources (main_class_foo, $main_class_stuff )
Main_class_foo <| |>
-------------------------
Or do I need to do it like this:
Same <whatever>.pp
<whatever>.yaml
-------------------------
main_class_foo::subclass_one:
parameter_one_a: this
parameter_one_b: that
main_class_foo::subclass_two:
parameter_two_a: other
parameter_two_b: whatever
-------------------------
<another-whatever>.pp
-------------------------
$main_class_one_stuff = hiera_hash ( ''main_class_foo::subclass_one’ )
create resources (main_class_foo::subclass_one, $main_class_one_stuff )
$main_class_two_stuff = hiera_hash (
''main_class_foo::subclass_two'' )
create resources (main_class_foo::subclass_two, $main_class_two_stuff )
Main_class_foo::Subclass_one <| |>
Main_class_foo::Subclass_two <| |>
-------------------------
On Feb 11, 2013, at 5:00 PM, Ellison Marks wrote:
> I don''t see your spaceship, but that aside, I believe that your
create resources call will try to instantiate two main_class_foo classes, named
subclass_one and subclass_two, with the listed parameters. I don''t
think you can use create_resources to instantiate different kinds of classes.
>
> On Monday, February 11, 2013 11:41:33 AM UTC-8, Ygor wrote:
> OK, I have a collection of related classes --
>
> main_class_foo::subclass_one
> main_class_foo::subclass_two
> ... etc
>
> And each subclass has parameters,
>
> class main_class_foo::subclass_one ( $parameter_one_a, $parameter_one_b ) {
... }
> class main_class_foo::subclass_two ( $parameter_two_a, $parameter_two_b ) {
... }
>
>
> so can I make a hiera file like this:
>
>
> main_class_foo:
> subclass_one:
> parameter_one_a: this
> parameter_one_b: that
> subclass_two:
> parameter_two_a: other
> parameter_two_b: whatever
>
> ...and then load it with create_resources and instantiate it with an empty
spaceship operator like this:
>
> $main_class_stuff = hiera_hash ( ''main_class_foo'' )
> create resources (main_class_foo, $main_class_stuff )
>
> Is that correct ?
>
> “Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.”
> Bill Waterson (Calvin & Hobbes)
>
>
> --
> 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 puppet-users+unsubscribe@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
The second example would work, I think, but then one asks why are we using a call to create_resources to create one resource? What is the eventual goal of this code, is what I''m trying to ask. On Monday, February 11, 2013 5:58:08 PM UTC-8, Ygor wrote:> > OK. Lets try it like this: > > <whatever>.pp > ------------------------- > class main_class_foo::subclass_one ( > $parameter_one_a, > $parameter_one_b > ) { > ... > } > > class main_class_foo::subclass_two ( > $parameter_two_a, > $parameter_two_b > ) { > ... > } > ------------------------- > > <whatever>.yaml > ------------------------- > main_class_foo: > subclass_one: > parameter_one_a: this > parameter_one_b: that > subclass_two: > parameter_two_a: other > parameter_two_b: whatever > ------------------------- > > > <another-whatever>.pp > ------------------------- > $main_class_stuff = hiera_hash ( ''main_class_foo'' ) > create resources (main_class_foo, $main_class_stuff ) > > Main_class_foo <| |> > ------------------------- > > Or do I need to do it like this: > > Same <whatever>.pp > > <whatever>.yaml > ------------------------- > main_class_foo::subclass_one: > parameter_one_a: this > parameter_one_b: that > main_class_foo::subclass_two: > parameter_two_a: other > parameter_two_b: whatever > ------------------------- > > <another-whatever>.pp > ------------------------- > $main_class_one_stuff = hiera_hash ( ''main_class_foo::subclass_one’ ) > create resources (main_class_foo::subclass_one, $main_class_one_stuff ) > > $main_class_two_stuff = hiera_hash ( ''main_class_foo::subclass_two'' ) > create resources (main_class_foo::subclass_two, $main_class_two_stuff ) > > Main_class_foo::Subclass_one <| |> > Main_class_foo::Subclass_two <| |> > ------------------------- > > On Feb 11, 2013, at 5:00 PM, Ellison Marks wrote: > > > I don''t see your spaceship, but that aside, I believe that your create > resources call will try to instantiate two main_class_foo classes, named > subclass_one and subclass_two, with the listed parameters. I don''t think > you can use create_resources to instantiate different kinds of classes. > > > > On Monday, February 11, 2013 11:41:33 AM UTC-8, Ygor wrote: > > OK, I have a collection of related classes -- > > > > main_class_foo::subclass_one > > main_class_foo::subclass_two > > ... etc > > > > And each subclass has parameters, > > > > class main_class_foo::subclass_one ( $parameter_one_a, $parameter_one_b > ) { ... } > > class main_class_foo::subclass_two ( $parameter_two_a, $parameter_two_b > ) { ... } > > > > > > so can I make a hiera file like this: > > > > > > main_class_foo: > > subclass_one: > > parameter_one_a: this > > parameter_one_b: that > > subclass_two: > > parameter_two_a: other > > parameter_two_b: whatever > > > > ...and then load it with create_resources and instantiate it with an > empty spaceship operator like this: > > > > $main_class_stuff = hiera_hash ( ''main_class_foo'' ) > > create resources (main_class_foo, $main_class_stuff ) > > > > Is that correct ? > > > > “Sometimes I think the surest sign that intelligent life exists > elsewhere in the universe is that none of it has tried to contact us.” > > Bill Waterson (Calvin & Hobbes) > > > > > > -- > > 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 puppet-users...@googlegroups.com <javascript:>. > > To post to this group, send email to puppet...@googlegroups.com<javascript:>. > > > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > >-- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Ellison is right, it really doesn''t make much sense to create one
resource
with create_resources. In fact, I''m not even sure it will work with
classes because I''ve never tried it. However, it works great for
defined
types. I think I understand what you''re trying to do so let me give an
example of how you could accomplish it.
I *think* your goal is to be able to define not only parameters in hiera
but also classes to be applied to a node. You need an additional piece in
your site.pp file to do this.
include
hiera_array(''classes'',[''hiera'',''puppet''])
The array at the end is optional, and represents defaults. In our case, we
included hiera and puppet classes as defaults because there was a chicken
and the egg scenario on the puppet master. That''s above and beyond
this
example, though. What the above will do is collect all values defined as
an array called "classes" from hiera. It will merge results all the
way
down the hierarchy so you can define your ''base'' classes in
your global
hiera file and get more specific as you go down and it will all be picked
up. In hiera, define classes like this:
---
classes:
- ''class1''
- ''class2::foo''
- ''class3::bar''
- etc
Then you can go about adding any parameters that need defined for those
classes:
class1::param1: ''boom''
class2::array1:
- ''foo''
- ''bar''
- ''baz''
class2::param2: ''thing''
That''s it. You''re done. I hope this helps. Please let me
know if you
need more help with this example.
On Monday, February 11, 2013 7:58:08 PM UTC-6, Ygor
wrote:>
> OK. Lets try it like this:
>
> <whatever>.pp
> -------------------------
> class main_class_foo::subclass_one (
> $parameter_one_a,
> $parameter_one_b
> ) {
> ...
> }
>
> class main_class_foo::subclass_two (
> $parameter_two_a,
> $parameter_two_b
> ) {
> ...
> }
> -------------------------
>
> <whatever>.yaml
> -------------------------
> main_class_foo:
> subclass_one:
> parameter_one_a: this
> parameter_one_b: that
> subclass_two:
> parameter_two_a: other
> parameter_two_b: whatever
> -------------------------
>
>
> <another-whatever>.pp
> -------------------------
> $main_class_stuff = hiera_hash ( ''main_class_foo'' )
> create resources (main_class_foo, $main_class_stuff )
>
> Main_class_foo <| |>
> -------------------------
>
> Or do I need to do it like this:
>
> Same <whatever>.pp
>
> <whatever>.yaml
> -------------------------
> main_class_foo::subclass_one:
> parameter_one_a: this
> parameter_one_b: that
> main_class_foo::subclass_two:
> parameter_two_a: other
> parameter_two_b: whatever
> -------------------------
>
> <another-whatever>.pp
> -------------------------
> $main_class_one_stuff = hiera_hash (
''main_class_foo::subclass_one’ )
> create resources (main_class_foo::subclass_one, $main_class_one_stuff )
>
> $main_class_two_stuff = hiera_hash (
''main_class_foo::subclass_two'' )
> create resources (main_class_foo::subclass_two, $main_class_two_stuff )
>
> Main_class_foo::Subclass_one <| |>
> Main_class_foo::Subclass_two <| |>
> -------------------------
>
> On Feb 11, 2013, at 5:00 PM, Ellison Marks wrote:
>
> > I don''t see your spaceship, but that aside, I believe that
your create
> resources call will try to instantiate two main_class_foo classes, named
> subclass_one and subclass_two, with the listed parameters. I don''t
think
> you can use create_resources to instantiate different kinds of classes.
> >
> > On Monday, February 11, 2013 11:41:33 AM UTC-8, Ygor wrote:
> > OK, I have a collection of related classes --
> >
> > main_class_foo::subclass_one
> > main_class_foo::subclass_two
> > ... etc
> >
> > And each subclass has parameters,
> >
> > class main_class_foo::subclass_one ( $parameter_one_a,
$parameter_one_b
> ) { ... }
> > class main_class_foo::subclass_two ( $parameter_two_a,
$parameter_two_b
> ) { ... }
> >
> >
> > so can I make a hiera file like this:
> >
> >
> > main_class_foo:
> > subclass_one:
> > parameter_one_a: this
> > parameter_one_b: that
> > subclass_two:
> > parameter_two_a: other
> > parameter_two_b: whatever
> >
> > ...and then load it with create_resources and instantiate it with an
> empty spaceship operator like this:
> >
> > $main_class_stuff = hiera_hash ( ''main_class_foo'' )
> > create resources (main_class_foo, $main_class_stuff )
> >
> > Is that correct ?
> >
> > “Sometimes I think the surest sign that intelligent life exists
> elsewhere in the universe is that none of it has tried to contact us.”
> > Bill Waterson (Calvin & Hobbes)
> >
> >
> > --
> > 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 puppet-users...@googlegroups.com <javascript:>.
> > To post to this group, send email to
puppet...@googlegroups.com<javascript:>.
>
> > Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
On Tuesday, February 12, 2013 7:16:21 AM UTC-6, Drew Blessing wrote:> > Ellison is right, it really doesn''t make much sense to create one resource > with create_resources. In fact, I''m not even sure it will work with > classes because I''ve never tried it. However, it works great for defined > types. I think I understand what you''re trying to do so let me give an > example of how you could accomplish it. > >While I have not done it myself, create_resources() can work with classes, As far as using create_resources() on a single resource, I do that in a few cases because while I only need one right now but I expect to need more later, or some nodes need one one and others need more, and the data comes from hiera.> I *think* your goal is to be able to define not only parameters in hiera > but also classes to be applied to a node. You need an additional piece in > your site.pp file to do this. > > include hiera_array(''classes'',[''hiera'',''puppet'']) > The array at the end is optional, and represents defaults. In our case, > we included hiera and puppet classes as defaults because there was a > chicken and the egg scenario on the puppet master. That''s above and beyond > this example, though. What the above will do is collect all values defined > as an array called "classes" from hiera. It will merge results all the way > down the hierarchy so you can define your ''base'' classes in your global > hiera file and get more specific as you go down and it will all be picked > up. In hiera, define classes like this: > --- > classes: > - ''class1'' > - ''class2::foo'' > - ''class3::bar'' > - etc > > Then you can go about adding any parameters that need defined for those > classes: > > class1::param1: ''boom'' > class2::array1: > - ''foo'' > - ''bar'' > - ''baz'' > class2::param2: ''thing'' > > That''s it. You''re done. I hope this helps. Please let me know if you > need more help with this example. > > On Monday, February 11, 2013 7:58:08 PM UTC-6, Ygor wrote: >> >> OK. Lets try it like this: >> >> <whatever>.pp >> ------------------------- >> class main_class_foo::subclass_one ( >> $parameter_one_a, >> $parameter_one_b >> ) { >> ... >> } >> >> class main_class_foo::subclass_two ( >> $parameter_two_a, >> $parameter_two_b >> ) { >> ... >> } >> ------------------------- >> >> <whatever>.yaml >> ------------------------- >> main_class_foo: >> subclass_one: >> parameter_one_a: this >> parameter_one_b: that >> subclass_two: >> parameter_two_a: other >> parameter_two_b: whatever >> ------------------------- >> >> >> <another-whatever>.pp >> ------------------------- >> $main_class_stuff = hiera_hash ( ''main_class_foo'' ) >> create resources (main_class_foo, $main_class_stuff ) >> >> Main_class_foo <| |> >> ------------------------- >> >> Or do I need to do it like this: >> >> Same <whatever>.pp >> >> <whatever>.yaml >> ------------------------- >> main_class_foo::subclass_one: >> parameter_one_a: this >> parameter_one_b: that >> main_class_foo::subclass_two: >> parameter_two_a: other >> parameter_two_b: whatever >> ------------------------- >> >> <another-whatever>.pp >> ------------------------- >> $main_class_one_stuff = hiera_hash ( ''main_class_foo::subclass_one’ ) >> create resources (main_class_foo::subclass_one, $main_class_one_stuff ) >> >> $main_class_two_stuff = hiera_hash ( ''main_class_foo::subclass_two'' ) >> create resources (main_class_foo::subclass_two, $main_class_two_stuff ) >> >> Main_class_foo::Subclass_one <| |> >> Main_class_foo::Subclass_two <| |> >> ------------------------- >> >> On Feb 11, 2013, at 5:00 PM, Ellison Marks wrote: >> >> > I don''t see your spaceship, but that aside, I believe that your create >> resources call will try to instantiate two main_class_foo classes, named >> subclass_one and subclass_two, with the listed parameters. I don''t think >> you can use create_resources to instantiate different kinds of classes. >> > >> > On Monday, February 11, 2013 11:41:33 AM UTC-8, Ygor wrote: >> > OK, I have a collection of related classes -- >> > >> > main_class_foo::subclass_one >> > main_class_foo::subclass_two >> > ... etc >> > >> > And each subclass has parameters, >> > >> > class main_class_foo::subclass_one ( $parameter_one_a, $parameter_one_b >> ) { ... } >> > class main_class_foo::subclass_two ( $parameter_two_a, $parameter_two_b >> ) { ... } >> > >> > >> > so can I make a hiera file like this: >> > >> > >> > main_class_foo: >> > subclass_one: >> > parameter_one_a: this >> > parameter_one_b: that >> > subclass_two: >> > parameter_two_a: other >> > parameter_two_b: whatever >> > >> > ...and then load it with create_resources and instantiate it with an >> empty spaceship operator like this: >> > >> > $main_class_stuff = hiera_hash ( ''main_class_foo'' ) >> > create resources (main_class_foo, $main_class_stuff ) >> > >> > Is that correct ? >> > >> > “Sometimes I think the surest sign that intelligent life exists >> elsewhere in the universe is that none of it has tried to contact us.” >> > Bill Waterson (Calvin & Hobbes) >> > >> > >> > -- >> > 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 puppet-users...@googlegroups.com. >> > To post to this group, send email to puppet...@googlegroups.com. >> > Visit this group at http://groups.google.com/group/puppet-users?hl=en. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >>-- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Tuesday, February 12, 2013 7:16:21 AM UTC-6, Drew Blessing wrote:> > > Then you can go about adding any parameters that need defined for those > classes: > > class1::param1: ''boom'' > class2::array1: > - ''foo'' > - ''bar'' > - ''baz'' > class2::param2: ''thing'' > > That''s it. You''re done. I hope this helps. Please let me know if you > need more help with this example. > >+1 With the Puppet''s integration of Hiera with parametrized classes and its support for array arguments to the ''include'' function, I cannot think of a case where it makes sense to declare classes via create_resources(). 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Tuesday, February 12, 2013 8:09:49 AM UTC-6, jcbollinger wrote:> > > > On Tuesday, February 12, 2013 7:16:21 AM UTC-6, Drew Blessing wrote: >> >> >> Then you can go about adding any parameters that need defined for those >> classes: >> >> class1::param1: ''boom'' >> class2::array1: >> - ''foo'' >> - ''bar'' >> - ''baz'' >> class2::param2: ''thing'' >> >> That''s it. You''re done. I hope this helps. Please let me know if you >> need more help with this example. >> >> > +1 > > With the Puppet''s integration of Hiera with parametrized classes and its > support for array arguments to the ''include'' function, I cannot think of a > case where it makes sense to declare classes via create_resources(). > >I never said it made sense... just that you could. :D> > 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
My initial goal is to just define the parameters.
Declaring the classes in hiera was the intended final goal, but I was wanting to
do it in steps.
All this info helps.
Thanks, all
“Sometimes I think the surest sign that intelligent life exists elsewhere in the
universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)
----- Original Message -----
From: "Drew Blessing" <drew.blessing@mac.com>
To: puppet-users@googlegroups.com
Sent: Tuesday, February 12, 2013 8:16:21 AM
Subject: Re: [Puppet Users] Getting dangerous with hiera
Ellison is right, it really doesn''t make much sense to create one
resource with create_resources. In fact, I''m not even sure it will work
with classes because I''ve never tried it. However, it works great for
defined types. I think I understand what you''re trying to do so let me
give an example of how you could accomplish it.
I think your goal is to be able to define not only parameters in hiera but also
classes to be applied to a node. You need an additional piece in your site.pp
file to do this.
include hiera_array( ''classes'' ,[ ''hiera'' ,
''puppet'' ])
The array at the end is optional, and represents defaults. In our case, we
included hiera and puppet classes as defaults because there was a chicken and
the egg scenario on the puppet master. That''s above and beyond this
example, though. What the above will do is collect all values defined as an
array called "classes" from hiera. It will merge results all the way
down the hierarchy so you can define your ''base'' classes in
your global hiera file and get more specific as you go down and it will all be
picked up. In hiera, define classes like this:
---
classes:
- ''class1''
- ''class2::foo''
- ''class3::bar''
- etc
Then you can go about adding any parameters that need defined for those classes:
class1::param1: ''boom''
class2::array1:
- ''foo''
- ''bar''
- ''baz''
class2::param2: ''thing''
That''s it. You''re done. I hope this helps. Please let me know
if you need more help with this example.
On Monday, February 11, 2013 7:58:08 PM UTC-6, Ygor wrote:
OK. Lets try it like this:
<whatever>.pp
-------------------------
class main_class_foo::subclass_one (
$parameter_one_a,
$parameter_one_b
) {
...
}
class main_class_foo::subclass_two (
$parameter_two_a,
$parameter_two_b
) {
...
}
-------------------------
<whatever>.yaml
-------------------------
main_class_foo:
subclass_one:
parameter_one_a: this
parameter_one_b: that
subclass_two:
parameter_two_a: other
parameter_two_b: whatever
-------------------------
<another-whatever>.pp
-------------------------
$main_class_stuff = hiera_hash ( ''main_class_foo'' )
create resources (main_class_foo, $main_class_stuff )
Main_class_foo <| |>
-------------------------
Or do I need to do it like this:
Same <whatever>.pp
<whatever>.yaml
-------------------------
main_class_foo::subclass_one:
parameter_one_a: this
parameter_one_b: that
main_class_foo::subclass_two:
parameter_two_a: other
parameter_two_b: whatever
-------------------------
<another-whatever>.pp
-------------------------
$main_class_one_stuff = hiera_hash ( ''main_class_foo::subclass_one’ )
create resources (main_class_foo::subclass_one, $main_class_one_stuff )
$main_class_two_stuff = hiera_hash (
''main_class_foo::subclass_two'' )
create resources (main_class_foo::subclass_two, $main_class_two_stuff )
Main_class_foo::Subclass_one <| |>
Main_class_foo::Subclass_two <| |>
-------------------------
On Feb 11, 2013, at 5:00 PM, Ellison Marks wrote:
> I don''t see your spaceship, but that aside, I believe that your
create resources call will try to instantiate two main_class_foo classes, named
subclass_one and subclass_two, with the listed parameters. I don''t
think you can use create_resources to instantiate different kinds of classes.
>
> On Monday, February 11, 2013 11:41:33 AM UTC-8, Ygor wrote:
> OK, I have a collection of related classes --
>
> main_class_foo::subclass_one
> main_class_foo::subclass_two
> ... etc
>
> And each subclass has parameters,
>
> class main_class_foo::subclass_one ( $parameter_one_a, $parameter_one_b ) {
... }
> class main_class_foo::subclass_two ( $parameter_two_a, $parameter_two_b ) {
... }
>
>
> so can I make a hiera file like this:
>
>
> main_class_foo:
> subclass_one:
> parameter_one_a: this
> parameter_one_b: that
> subclass_two:
> parameter_two_a: other
> parameter_two_b: whatever
>
> ...and then load it with create_resources and instantiate it with an empty
spaceship operator like this:
>
> $main_class_stuff = hiera_hash ( ''main_class_foo'' )
> create resources (main_class_foo, $main_class_stuff )
>
> Is that correct ?
>
> “Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.”
> Bill Waterson (Calvin & Hobbes)
>
>
> --
> 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 puppet-users...@googlegroups.com .
> To post to this group, send email to puppet...@googlegroups.com .
> Visit this group at http://groups.google.com/group/puppet-users?hl=en .
> For more options, visit https://groups.google.com/groups/opt_out .
>
>
--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en .
For more options, visit https://groups.google.com/groups/opt_out .
--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.