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 <[email protected]> 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 <[email protected]> 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 <[email protected]> wrote:
>
> On Wed, Jun 30, 2010 at 10:40 AM, CraftyTech <[email protected]> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.