Your best bet is to write a custom fact that returns the status of httpd
installation.
There is a good tutorial on writing custom facts in the docs.
Trevor
On 06/01/2010 05:31 PM, Bill Weiss wrote:
> All,
>
> Sorry if this is a FAQ that I?ve missed. A pointer to TFM would be
> appreciated if so.
>
> I?m looking for a conditional include of sorts. In module X, I?d like
> to frob a file if the httpd package is installed. If it?s not, I want
> to just skip it. Is there a simple way to do this?
>
> Thanks.
>
> --
> Bill Weiss
> Backstop Solutions Group
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
- --
Trevor Vaughan
Vice President, Onyx Point, Inc.
email: tvau...@onyxpoint.com
phone: 410-541-ONYX (6699)
pgp: 0x6C701E94
- -- This account not approved for unencrypted sensitive information --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAkwFpggACgkQyWMIJmxwHpQSZgCgziFUAs5QI9V/48XCmQhAU6uw
vHwAnRL61ZihpE3iwvoBk6klOAFOHCGy
=EOK8
-----END PGP SIGNATURE-----
> Sorry if this is a FAQ that I’ve missed. A pointer to TFM would be
> appreciated if so.
>
> I’m looking for a conditional include of sorts. In module X, I’d like to
> frob a file if the httpd package is installed. If it’s not, I want to just
> skip it. Is there a simple way to do this?
Other people pointed you to writing a custom fact. Let me instead tell you
why this isn't the best strategy, and suggest another approach that might work
better in the long run:
Generally speaking, the more decisions you make in your code the harder it is
to understand. For example, module foo might do something or might not based
on module bar being included — in this case, module bar is the HTTPD package
being installed.
A better approach, and one that is simpler, is to specify policy:
Any host that needs a web server has httpd installed and this file
frobbed.
Any host that doesn't need a web server does not have httpd installed.
Then, code that up in your manifests without the decision:
In X, install httpd[1] and frob the file. In Y, don't do either.
Daniel
Footnotes:
[1] Probably best done by include a httpd class rather than directly writing
out the 'package' stanza, so other modules can also add the httpd service.
--
✣ Daniel Pittman ✉ dan...@rimspace.net ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons
If you can decide in your node source (site.pp or external) which
components are needed, this is very easy:
node a { include X }
node b { include Y }
node c { include X,Y }
node d { }
If you **cannot** decide in your node source, you're probably doing
something wrong[1] and need to explain your problem better.
Best Regards, David
[1] I know, converting legacy systems is a pain, but IMHO you're still
better off doing a manual survey and nailing it down instead of trying
to make automatic decisions that'll backfire down the road.
--
dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at
Klosterneuburg UID: ATU64260999
FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg