Hello All,
Can someone point me in the right direction here. I''m trying to
create an erb template for my /etc/hosts file, so that when executed,
it populates the /etc/hosts file only with entries that are tag
relevant. For instance, if a server is tagged apache, only the apache
tagged entries would be populated into the /etc/hosts file. Thanks in
advance for you help.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
On 30 June 2010 18:40, CraftyTech <hmmedina@gmail.com> wrote:> Hello All, > > Can someone point me in the right direction here. I''m trying to > create an erb template for my /etc/hosts file, so that when executed, > it populates the /etc/hosts file only with entries that are tag > relevant. For instance, if a server is tagged apache, only the apache > tagged entries would be populated into the /etc/hosts file. Thanks in > advance for you help.This is possible with `if all_tags.include?("<sometag>")`. But, and a big but, it is highly dependent on the order which your modules are compiled[0]. It will prove unreliable if your Apache module happens to be `included` after the module which is creating the templated hosts file. For this reason it will introduce extra use complexity into your modules and most people will probably recommend that you use facts instead. It happens to be a bit of a bug bear of mine because it is otherwise quite a useful feature that precludes the mess of populating additional facts. The conundrum is similar to a recent thread[1] entitled "do X if package Y is installed". [0] That is "compiled" by the puppetmaster. Not "executed" by the puppet client. [1] http://groups.google.com/group/puppet-users/browse_thread/thread/b037fa88eb09b8ae -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Interesting.. Thanks for the feedback. I think that a custom fact is the way to go then...I''ll do some experimenting, and I''ll post the results in case someone else can benefit from topic... Cheers, Henry On Jun 30, 1:59 pm, Dan Carley <dan.car...@gmail.com> wrote:> On 30 June 2010 18:40, CraftyTech <hmmed...@gmail.com> wrote: > > > Hello All, > > > Can someone point me in the right direction here. I''m trying to > > create an erb template for my /etc/hosts file, so that when executed, > > it populates the /etc/hosts file only with entries that are tag > > relevant. For instance, if a server is tagged apache, only the apache > > tagged entries would be populated into the /etc/hosts file. Thanks in > > advance for you help. > > This is possible with `if all_tags.include?("<sometag>")`. > > But, and a big but, it is highly dependent on the order which your modules > are compiled[0]. It will prove unreliable if your Apache module happens to > be `included` after the module which is creating the templated hosts file. > For this reason it will introduce extra use complexity into your modules and > most people will probably recommend that you use facts instead. > > It happens to be a bit of a bug bear of mine because it is otherwise quite a > useful feature that precludes the mess of populating additional facts. The > conundrum is similar to a recent thread[1] entitled "do X if package Y is > installed". > > [0] That is "compiled" by the puppetmaster. Not "executed" by the puppet > client. > [1]http://groups.google.com/group/puppet-users/browse_thread/thread/b037...-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
This also vexes me, I also would love to use ''all_tags'', but it''s not consistent. The issues is best described in the following bug, I believe: http://projects.puppetlabs.com/issues/3049 On Jun 30, 10:59 am, Dan Carley <dan.car...@gmail.com> wrote:> On 30 June 2010 18:40, CraftyTech <hmmed...@gmail.com> wrote: > > > Hello All, > > > Can someone point me in the right direction here. I''m trying to > > create an erb template for my /etc/hosts file, so that when executed, > > it populates the /etc/hosts file only with entries that are tag > > relevant. For instance, if a server is tagged apache, only the apache > > tagged entries would be populated into the /etc/hosts file. Thanks in > > advance for you help. > > This is possible with `if all_tags.include?("<sometag>")`. > > But, and a big but, it is highly dependent on the order which your modules > are compiled[0]. It will prove unreliable if your Apache module happens to > be `included` after the module which is creating the templated hosts file. > For this reason it will introduce extra use complexity into your modules and > most people will probably recommend that you use facts instead. > > It happens to be a bit of a bug bear of mine because it is otherwise quite a > useful feature that precludes the mess of populating additional facts. The > conundrum is similar to a recent thread[1] entitled "do X if package Y is > installed". > > [0] That is "compiled" by the puppetmaster. Not "executed" by the puppet > client. > [1]http://groups.google.com/group/puppet-users/browse_thread/thread/b037...-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 1 July 2010 18:17, jb <jeffbehl@gmail.com> wrote:> This also vexes me, I also would love to use ''all_tags'', but it''s not > consistent. The issues is best described in the following bug, I > believe: > > http://projects.puppetlabs.com/issues/3049Good call. I wasn''t aware there was an existing ticket for it. For what it''s worth, I have conceded to using all_tags in some cases, by writing and documenting the execution order into my manifests. I''ve had a number of instances whereby I want module X to behave differently if module Y is present, without having to put additional cross-dependencies into module Y. It''s not something that I''m thrilled about though because the principle of least surprise is out the window if you pick up a module and use it in a slightly different way. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Wed, Jun 30, 2010 at 10:40 AM, CraftyTech <hmmedina@gmail.com> wrote:> Hello All, > > Can someone point me in the right direction here. I''m trying to > create an erb template for my /etc/hosts file, so that when executed, > it populates the /etc/hosts file only with entries that are tag > relevant. For instance, if a server is tagged apache, only the apache > tagged entries would be populated into the /etc/hosts file. Thanks in > advance for you help.I recommend using the built in host type to model and manage entries in /etc/hosts rather than a template. Modeling your configuration using a type rather than a file will allow you to declare the resources as virtual, then simply realize them if they''re tagged with the tag you care about. In addition, you''ll receive a bunch of additional features "for free" like the relationship graph, meta-parameters, reporting, etc... For example: class apache { @host { "zaphod": ip => "1.2.3.4" } } # Realize host entries tagged with "apache" Host <| tag == "apache" |> -- Jeff McCune http://www.puppetlabs.com/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks for the feedback Jeff. Interesting feature that I had unfortunately overlooked until now, but the basic question still remains; how would I then generate specific hostfiles based on nodes of the same tag? For instance, a web server to only have host entries for items tagged webserver only, and not one large on-size-fits-all file. Thanks, On Jul 2, 9:39 pm, Jeff McCune <j...@puppetlabs.com> wrote:> On Wed, Jun 30, 2010 at 10:40 AM, CraftyTech <hmmed...@gmail.com> wrote: > > Hello All, > > > Can someone point me in the right direction here. I''m trying to > > create an erb template for my /etc/hosts file, so that when executed, > > it populates the /etc/hosts file only with entries that are tag > > relevant. For instance, if a server is tagged apache, only the apache > > tagged entries would be populated into the /etc/hosts file. Thanks in > > advance for you help. > > I recommend using the built in host type to model and manage entries > in /etc/hosts rather than a template. > > Modeling your configuration using a type rather than a file will allow > you to declare the resources as virtual, then simply realize them if > they''re tagged with the tag you care about. In addition, you''ll > receive a bunch of additional features "for free" like the > relationship graph, meta-parameters, reporting, etc... > > For example: > > class apache { > @host { "zaphod": ip => "1.2.3.4" } > > } > > # Realize host entries tagged with "apache" > Host <| tag == "apache" |> > > -- > Jeff McCunehttp://www.puppetlabs.com/-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Take a look at http://docs.puppetlabs.com/guides/exported_resources.html. I think this will give you what you want. It will only work if you turn on storeconfigs. On Jul 12, 2010, at 5:43 AM, CraftyTech wrote:> Thanks for the feedback Jeff. Interesting feature that I had > unfortunately overlooked until now, but the basic question still > remains; how would I then generate specific hostfiles based on nodes > of the same tag? For instance, a web server to only have host entries > for items tagged webserver only, and not one large on-size-fits-all > file. Thanks, > > On Jul 2, 9:39 pm, Jeff McCune <j...@puppetlabs.com> wrote: >> On Wed, Jun 30, 2010 at 10:40 AM, CraftyTech <hmmed...@gmail.com> wrote: >>> Hello All, >> >>> Can someone point me in the right direction here. I''m trying to >>> create an erb template for my /etc/hosts file, so that when executed, >>> it populates the /etc/hosts file only with entries that are tag >>> relevant. For instance, if a server is tagged apache, only the apache >>> tagged entries would be populated into the /etc/hosts file. Thanks in >>> advance for you help. >> >> I recommend using the built in host type to model and manage entries >> in /etc/hosts rather than a template. >> >> Modeling your configuration using a type rather than a file will allow >> you to declare the resources as virtual, then simply realize them if >> they''re tagged with the tag you care about. In addition, you''ll >> receive a bunch of additional features "for free" like the >> relationship graph, meta-parameters, reporting, etc... >> >> For example: >> >> class apache { >> @host { "zaphod": ip => "1.2.3.4" } >> >> } >> >> # Realize host entries tagged with "apache" >> Host <| tag == "apache" |> >> >> -- >> Jeff McCunehttp://www.puppetlabs.com/ > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
As Patrick mentions, one solution i recommend is to enable storeconfigs and
have each node export a host entry for itself tagged with the tag you want
other hosts to collect.
For example, each node may export it''s host entry with:
@@host { "$fqdn": ip_address => $ipaddress, tags =>
"webserver" }
The cluster may collect these resources to build the hosts file with:
Host <<|| tag == "webserver" ||>>
On my phone, so parameter names may not be perfect.
Hope this helps,
--
Jeff McCune - (+1-503-208-4484)
On Jul 12, 2010, at 8:54 AM, Patrick Mohr <kc7zzv@gmail.com> wrote:
Take a look at http://docs.puppetlabs.com/guides/exported_resources.html. I
think this will give you what you want. *It will only work if you turn on
storeconfigs.*
On Jul 12, 2010, at 5:43 AM, CraftyTech wrote:
Thanks for the feedback Jeff. Interesting feature that I had
unfortunately overlooked until now, but the basic question still
remains; how would I then generate specific hostfiles based on nodes
of the same tag? For instance, a web server to only have host entries
for items tagged webserver only, and not one large on-size-fits-all
file. Thanks,
On Jul 2, 9:39 pm, Jeff McCune <j...@puppetlabs.com> wrote:
On Wed, Jun 30, 2010 at 10:40 AM, CraftyTech <hmmed...@gmail.com> wrote:
Hello All,
Can someone point me in the right direction here. I''m trying to
create an erb template for my /etc/hosts file, so that when executed,
it populates the /etc/hosts file only with entries that are tag
relevant. For instance, if a server is tagged apache, only the apache
tagged entries would be populated into the /etc/hosts file. Thanks in
advance for you help.
I recommend using the built in host type to model and manage entries
in /etc/hosts rather than a template.
Modeling your configuration using a type rather than a file will allow
you to declare the resources as virtual, then simply realize them if
they''re tagged with the tag you care about. In addition,
you''ll
receive a bunch of additional features "for free" like the
relationship graph, meta-parameters, reporting, etc...
For example:
class apache {
@host { "zaphod": ip => "1.2.3.4" }
}
# Realize host entries tagged with "apache"
Host <| tag == "apache" |>
--
Jeff McCunehttp://www.puppetlabs.com/
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Sounds pretty interesting, specially since I always had store configs
running... I''m now able to circle back to this issue and re-focus on
automatically generating my /etc/hosts file. So, should the exporting
of the necessary values be done in the same class as the collection,
or should I just outline it on my default node definition. Here''s
what I have so far (and it''s not working):
class hostsfile {
@@host { "$fqdn": ip_address => $ipaddress, tags =>
"webserver" }
Host <<| tag == "webserver" |>>
file { "/etc/hosts": ensure => present}
}
Another thing, how do I ensure that the contents of "file" are what
was collected via the "Host" collection? If someone has a similar
scenario running, please share your ideas...
Thanks,
On Jul 12, 12:06 pm, Jeff McCune <j...@reductivelabs.com>
wrote:> As Patrick mentions, one solution i recommend is to enable storeconfigs and
> have each node export a host entry for itself tagged with the tag you want
> other hosts to collect.
>
> For example, each node may export it''s host entry with:
> @@host { "$fqdn": ip_address => $ipaddress, tags =>
"webserver" }
>
> The cluster may collect these resources to build the hosts file with:
>
> Host <<|| tag == "webserver" ||>>
>
> On my phone, so parameter names may not be perfect.
>
> Hope this helps,
> --
> Jeff McCune - (+1-503-208-4484)
>
> On Jul 12, 2010, at 8:54 AM, Patrick Mohr <kc7...@gmail.com> wrote:
>
> Take a look athttp://docs.puppetlabs.com/guides/exported_resources.html. I
> think this will give you what you want. *It will only work if you turn on
> storeconfigs.*
>
> On Jul 12, 2010, at 5:43 AM, CraftyTech wrote:
>
> Thanks for the feedback Jeff. Interesting feature that I had
> unfortunately overlooked until now, but the basic question still
> remains; how would I then generate specific hostfiles based on nodes
> of the same tag? For instance, a web server to only have host entries
> for items tagged webserver only, and not one large on-size-fits-all
> file. Thanks,
>
> On Jul 2, 9:39 pm, Jeff McCune <j...@puppetlabs.com> wrote:
>
> On Wed, Jun 30, 2010 at 10:40 AM, CraftyTech <hmmed...@gmail.com>
wrote:
>
> Hello All,
>
> Can someone point me in the right direction here. I''m trying
to
>
> create an erb template for my /etc/hosts file, so that when executed,
>
> it populates the /etc/hosts file only with entries that are tag
>
> relevant. For instance, if a server is tagged apache, only the apache
>
> tagged entries would be populated into the /etc/hosts file. Thanks in
>
> advance for you help.
>
> I recommend using the built in host type to model and manage entries
>
> in /etc/hosts rather than a template.
>
> Modeling your configuration using a type rather than a file will allow
>
> you to declare the resources as virtual, then simply realize them if
>
> they''re tagged with the tag you care about. In addition,
you''ll
>
> receive a bunch of additional features "for free" like the
>
> relationship graph, meta-parameters, reporting, etc...
>
> For example:
>
> class apache {
>
> @host { "zaphod": ip => "1.2.3.4" }
>
> }
>
> # Realize host entries tagged with "apache"
>
> Host <| tag == "apache" |>
>
> --
>
> Jeff McCunehttp://www.puppetlabs.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscribe@googlegroups.com.
> For more options, visit this group
athttp://groups.google.com/group/puppet-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscribe@googlegroups.com.
> For more options, visit this group
athttp://groups.google.com/group/puppet-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Can anyone share how they do their /etc/hosts population from storeconfigs? Thanks, On Aug 6, 11:50 am, CraftyTech <hmmed...@gmail.com> wrote:> Sounds pretty interesting, specially since I always had store configs > running... I''m now able to circle back to this issue and re-focus on > automatically generating my /etc/hosts file. So, should the exporting > of the necessary values be done in the same class as the collection, > or should I just outline it on my default node definition. Here''s > what I have so far (and it''s not working): > > class hostsfile { > @@host { "$fqdn": ip_address => $ipaddress, tags => > "webserver" } > Host <<| tag == "webserver" |>> > file { "/etc/hosts": ensure => present} > } > > Another thing, how do I ensure that the contents of "file" are what > was collected via the "Host" collection? If someone has a similar > scenario running, please share your ideas... > > Thanks, > > On Jul 12, 12:06 pm, Jeff McCune <j...@reductivelabs.com> wrote: > > > > > As Patrick mentions, one solution i recommend is to enable storeconfigs and > > have each node export a host entry for itself tagged with the tag you want > > other hosts to collect. > > > For example, each node may export it''s host entry with: > > @@host { "$fqdn": ip_address => $ipaddress, tags => "webserver" } > > > The cluster may collect these resources to build the hosts file with: > > > Host <<|| tag == "webserver" ||>> > > > On my phone, so parameter names may not be perfect. > > > Hope this helps, > > -- > > Jeff McCune - (+1-503-208-4484) > > > On Jul 12, 2010, at 8:54 AM, Patrick Mohr <kc7...@gmail.com> wrote: > > > Take a look athttp://docs.puppetlabs.com/guides/exported_resources.html. I > > think this will give you what you want. *It will only work if you turn on > > storeconfigs.* > > > On Jul 12, 2010, at 5:43 AM, CraftyTech wrote: > > > Thanks for the feedback Jeff. Interesting feature that I had > > unfortunately overlooked until now, but the basic question still > > remains; how would I then generate specific hostfiles based on nodes > > of the same tag? For instance, a web server to only have host entries > > for items tagged webserver only, and not one large on-size-fits-all > > file. Thanks, > > > On Jul 2, 9:39 pm, Jeff McCune <j...@puppetlabs.com> wrote: > > > On Wed, Jun 30, 2010 at 10:40 AM, CraftyTech <hmmed...@gmail.com> wrote: > > > Hello All, > > > Can someone point me in the right direction here. I''m trying to > > > create anerbtemplate for my /etc/hosts file, so that when executed, > > > it populates the /etc/hosts file only with entries that are tag > > > relevant. For instance, if a server is tagged apache, only the apache > > > tagged entries would be populated into the /etc/hosts file. Thanks in > > > advance for you help. > > > I recommend using the built in host type to model and manage entries > > > in /etc/hosts rather than a template. > > > Modeling your configuration using a type rather than a file will allow > > > you to declare the resources as virtual, then simply realize them if > > > they''re tagged with the tag you care about. In addition, you''ll > > > receive a bunch of additional features "for free" like the > > > relationship graph, meta-parameters, reporting, etc... > > > For example: > > > class apache { > > > @host { "zaphod": ip => "1.2.3.4" } > > > } > > > # Realize host entries tagged with "apache" > > > Host <| tag == "apache" |> > > > -- > > > Jeff McCunehttp://www.puppetlabs.com/ > > > -- > > You received this message because you are subscribed to the Google Groups > > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com. > > For more options, visit this group athttp://groups.google.com/group/puppet-users?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com. > > For more options, visit this group athttp://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Aug 6, 8:50 am, CraftyTech <hmmed...@gmail.com> wrote:> So, should the exporting > of the necessary values be done in the same class as the collection, > or should I just outline it on my default node definition. Here''s > what I have so far (and it''s not working):Your example is pretty close. I don''t see an obvious reason for it to fail. I think you may into two issues in general. Nodes with both ''webserver'' & ''mailserver'' would export duplicate Host resources. That gets solved if you move the @@host to a third class and pass variables, but now you''re compile order dependent. Setting puppetvariables (in manifest) or detecting based on class seems difficult/unreliable. The best solution for you may be a fact or variable on your nodes describing which "group" they''re part of. node web { $group = ["web"] include webserver include host::collect } node webmail { $group = ["web", "mail"] include webserver include mailserver include host::collect } class webserver { include host::export } class mailserver { include host::export } class host::export { @@host{ "$fqdn": ip => $ipaddress, host_aliases => $hostname, tag => $group } } class host::collect { Host <<| tags == $group |>> }> Another thing, how do I ensure that the contents of "file" are what > was collected via the "Host" collection? If someone has a similar > scenario running, please share your ideas...There''s no need for the ''file { "/etc/hosts": }'' resource. The Host Type should take care of that. For example ''hosts'' may be stored in a different location or format. I do it a bit differently. Only nodes with "important" classes export their entries. All nodes will collect all relevant entries. This should work as an example. node dns1 { $location = ["chicago"] include dns include host::collect } node ldap1 { $location = ["chicago"] include ldap include host::collect } node admin1 { $location = ["austin"] include dns include ldap include host::collect } node db1 { $location = ["austin"] include host::collect } node db2 { $location = ["chicago"] include host::collect } class dns { include host::export } class ldap { include host::export } class host::export { @@host{ "$fqdn": ip => $ipaddress, host_aliases => $hostname, tag => $location } } class host::collect { Host <<| tags == $location |>> } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Donavan,
Thanks for the explanation. I now have a better understanding of
how the Host resource works.
Cheers,
Henry
On Aug 7, 3:20 pm, donavan <dona...@desinc.net>
wrote:> On Aug 6, 8:50 am, CraftyTech <hmmed...@gmail.com> wrote:
>
> > So, should the exporting
> > of the necessary values be done in the same class as the collection,
> > or should I just outline it on my default node definition.
Here''s
> > what I have so far (and it''s not working):
>
> Your example is pretty close. I don''t see an obvious reason for it
to
> fail.
>
> I think you may into two issues in general. Nodes with both
> ''webserver'' & ''mailserver'' would
export duplicate Host resources. That
> gets solved if you move the @@host to a third class and pass
> variables, but now you''re compile order dependent. Setting
> puppetvariables (in manifest) or detecting based on class seems
> difficult/unreliable. The best solution for you may be a fact or
> variable on your nodes describing which "group" they''re
part of.
>
> node web {
> $group = ["web"]
> include webserver
> include host::collect}
>
> node webmail {
> $group = ["web", "mail"]
> include webserver
> include mailserver
> include host::collect}
>
> class webserver { include host::export }
> class mailserver { include host::export }
> class host::export { @@host{ "$fqdn": ip => $ipaddress,
host_aliases
> => $hostname, tag => $group } }
> class host::collect { Host <<| tags == $group |>> }
>
> > Another thing, how do I ensure that the contents of "file"
are what
> > was collected via the "Host" collection? If someone has a
similar
> > scenario running, please share your ideas...
>
> There''s no need for the ''file { "/etc/hosts":
}'' resource. The Host
> Type should take care of that. For example ''hosts'' may be
stored in a
> different location or format.
>
> I do it a bit differently. Only nodes with "important" classes
export
> their entries. All nodes will collect all relevant entries. This
> should work as an example.
>
> node dns1 {
> $location = ["chicago"]
> include dns
> include host::collect}
>
> node ldap1 {
> $location = ["chicago"]
> include ldap
> include host::collect}
>
> node admin1 {
> $location = ["austin"]
> include dns
> include ldap
> include host::collect}
>
> node db1 {
> $location = ["austin"]
> include host::collect}
>
> node db2 {
> $location = ["chicago"]
> include host::collect
>
> }
>
> class dns { include host::export }
> class ldap { include host::export }
> class host::export { @@host{ "$fqdn": ip => $ipaddress,
host_aliases
> => $hostname, tag => $location } }
> class host::collect { Host <<| tags == $location |>> }
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.