-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I''m just getting started with using Puppet, and from what I''ve seen I really like it. However, I''m trying get started with slighly more advanced things like templates but I''m running into a roadblock with not knowing what built-in variables I have available to me. Is there someplace this is documented? Here''s what I''d like to do: class gentoo_make_settings { $use = $nodename ? { node1 => "-X -gnome -gtk -kde -qt hardened", node2 => "apache", default => "-X -gnome -gtk -kde -qt" } $str = "USE=\"$use\"\n" file { "/etc/make.conf" : owner => root, group => root, mode => 444, content => $str } } I see in the documentation examples variable like $operatingsystem and "name", but what other ones are available? Is there a list available somewhere? Is there a way to programatically expose them (like iterate over some built-in array and print it out using a template)? I''m not at all a Ruby guy, so don''t assume I know much about specifics of the language -- specifics and directions targeted for 4 yr olds much appreciated. - -- Paul Ortman PGP Key: 55602C81 - -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFFLRQVfw8KGlVgLIERAuv/AJ9WAq48T4W+1UsAnWR8EactExgd7ACbBqv0 DwcbKvKsGQbzofD8VvIhPb4=sSsY -----END PGP SIGNATURE-----
Paul Ortman wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I''m just getting started with using Puppet, and from what I''ve seen I > really like it. However, I''m trying get started with slighly more > advanced things like templates but I''m running into a roadblock with not > knowing what built-in variables I have available to me. Is there > someplace this is documented?They''re not actually built into Puppet, they''re pulled from Facter. So, you can get a list of valid Facts by just calling ''facter'' with no arguments.> Here''s what I''d like to do: > > class gentoo_make_settings { > $use = $nodename ? { > node1 => "-X -gnome -gtk -kde -qt hardened", > node2 => "apache", > default => "-X -gnome -gtk -kde -qt" > } > > $str = "USE=\"$use\"\n" > > file { "/etc/make.conf" : > owner => root, > group => root, > mode => 444, > content => $str } > }In this case, you''re looking for $hostname.> I see in the documentation examples variable like $operatingsystem and > "name", but what other ones are available? Is there a list available > somewhere? Is there a way to programatically expose them (like iterate > over some built-in array and print it out using a template)? I''m not at > all a Ruby guy, so don''t assume I know much about specifics of the > language -- specifics and directions targeted for 4 yr olds much > appreciated.Please let me know if what I''ve provided is not sufficient. -- One of the keys to happiness is a bad memory. -- Rita Mae Brown --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
> They''re not actually built into Puppet, they''re pulled from Facter. So, > you can get a list of valid Facts by just calling ''facter'' with no > arguments. >not really, if you have custom facts downloaded automaticaly by puppet ( factsync) then you will NOT see the facts you added to facter. This is a little disturbing. Is there an option to ask puppet to print out all the fact IT see ? Could be handy for debugging :) but for all built in fact this work fine :) Ghislain. _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Wed, Oct 11, 2006 at 06:59:43PM +0200, Adnet Ghislain wrote:> > >They''re not actually built into Puppet, they''re pulled from Facter. So, > >you can get a list of valid Facts by just calling ''facter'' with no > >arguments. > > > > not really, if you have custom facts downloaded automaticaly by puppet ( > factsync) then you will NOT see the facts you added to facter. This is a > little disturbing.... especially since that''s not how it''s supposed to work. Facter doesn''t, in fact (heh), have a notion of "built-in" vs "added" facts. If you examine the code for the "built-in" facts, they''re instantiated exactly the same way as extra facts you write yourself and distribute separately. The only "built-in-ness" of them is that they''re in facter.rb instead of a separate file (which isn''t even true of the memory and processor facts). If you''re not seeing your custom facts in the list produced by running the ''facter'' command line tool, then the fact either isn''t being run (possibly because Facter isn''t even defining it, or because the fact''s restrictions prevent it from running), or it returned ''nil'' (and hence didn''t get put into the output).> Is there an option to ask puppet to print out all the fact IT see ? Could > be handy for debugging :)The command line tool itself doesn''t provide it, but you can print all of the possible facts that Facter might display for you with a simple: ruby -e "require ''facter''; puts Facter.list.sort.inspect" Or, to get trickier: ruby -e "require ''facter''; require ''pp''; pp Facter.list.sort" - Matt -- How many Apple Newton users does it take to change a lightbulb? Foux. There to eat lemons, axe gravy soup. -- Seen on the ''net
Matthew Palmer wrote:> On Wed, Oct 11, 2006 at 06:59:43PM +0200, Adnet Ghislain wrote: >>> They''re not actually built into Puppet, they''re pulled from Facter. So, >>> you can get a list of valid Facts by just calling ''facter'' with no >>> arguments. >>> >> not really, if you have custom facts downloaded automaticaly by puppet ( >> factsync) then you will NOT see the facts you added to facter. This is a >> little disturbing. > > ... especially since that''s not how it''s supposed to work. Facter doesn''t, > in fact (heh), have a notion of "built-in" vs "added" facts. If you examine > the code for the "built-in" facts, they''re instantiated exactly the same way > as extra facts you write yourself and distribute separately. The only > "built-in-ness" of them is that they''re in facter.rb instead of a separate > file (which isn''t even true of the memory and processor facts).He''s actually talking about facts that Puppet downloads into $vardir/facts and loads. Facter doesn''t know anything about them on its own; Puppet has to load them explicitly. This is another not-so-documented feature; you can sync both plugins and facts before each run, so that youre configuration is compiled with the latest facts and plugins (plugins being normal types, but put into a separate directory so that you''re not writing to your ruby lib dir). -- The whole secret of life is to be interested in one thing profoundly and in a thousand things well. -- Horace Walpole --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Adnet Ghislain wrote:> >> They''re not actually built into Puppet, they''re pulled from Facter. >> So, you can get a list of valid Facts by just calling ''facter'' with no >> arguments. >> > > not really, if you have custom facts downloaded automaticaly by puppet ( > factsync) then you will NOT see the facts you added to facter. This is a > little disturbing. Is there an option to ask puppet to print out all the > fact IT see ? Could be handy for debugging :)Can you submit a bug on this? -- The whole secret of life is to be interested in one thing profoundly and in a thousand things well. -- Horace Walpole --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com