-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 06 December 2007, Grzegorz Marszałek wrote:> Hello!
>
> I''m quite newbie to puppet. I''ve got 3 questions:
>
> 1.
> I''ve noticed, that puppet apply defined classes/modules in
specyfic
> order. I''ve got something like this im my configs:
> /etc/puppet/cf/manifests/site.pp:
> import "networks/*/site.pp"
>
> node generic_node {
> include "puppet"
> include "apt"
> include "debian"
> }
> ---
> and then file /etc/puppet/cf/manifests/network/c0001.local/site.pp:
> node c0001.local inherits generic_node {
> <here are many variables definitions>
> include "hosts"
> }
> node "pc01.c0001.local" inherits c0001.local {
> include "gnome_desktop"
> }
> ---
>
> So, puppet gives me two problems here:
> - first is ordering. I don''t know how to force puppet to execute
> module apt and debian first :( It''s quite important to me - there
is
> no sense to install gnome desktop if I don''t have repositories
> configured. I know there are "before" and "require"
directives - but
> how to use them on whole modules? And that''s not always good think
-
> to hardcode order into modules... Any ideas?
You can require => Class["class_name"] on a resource or on a
define. This
should go at least half the way to where you want to go.
> - second are variables. For each network I define a lot of them. Ie.:
> $lan_subnet_ip, or $lan_subnet_range etc. I use them in modules ie.
> to generate dhpcd.conf file. But I can use them only after I defined
> them - ie. I cannot use those variables in puppet module, because
> puppet gives me "Could not find value for
''variable''" error. I''m
> doing something wrong, or is that just way puppet works? Other ideas?
> My only idea would be split configurations (and puppetmaster...) one
> per network, but...
See a recommended way to set node level variables under "template
class" at
http://reductivelabs.com/trac/puppet/wiki/GlossaryOfTerms#templateclass
> 2.
> Is there "best practice" to manage one file by many classes?
> Well, maybe I describe my problem :)
> I need to manage /etc/apt/source.list file.
> I do that in apt module. But I''d like to have possibility to add
> additional deb repositories from other modules (ie.: in gnome_desktop
> module I''d like to add backports repository to apt). I''ve
tried
> attaching lines via exec statements - but that of course doesn''t
> work: apt module rewrites file each time puppet is run... Then my
> lines are added, but I need to call additional apt-get update command.
> So - how to do that better? :)
In this specific case, use /etc/apt/sources.list.d/ which is available since
etch I believe. In the more general case, either use something
like "concatenated_file" or "line" from my
"common" module (see
http://reductivelabs.com/trac/puppet/wiki/CompleteConfiguration) or write a
native type parsing the file in question (see
http://reductivelabs.com/trac/puppet/wiki/CreatingCustomTypes)
> 3.
> Another question about apt: after changing sources.list I need to
> execute apt-get update. I do that this way:
>
> file { "/etc/apt/sources.list":
> source => "puppet://$server/apt/apt-sources-list",
> mode => 0644, owner => root, group => root,
> notify => Exec["AptUpdate"],
> }
> exec { "AptUpdate":
> command => "apt-get update",
> refreshonly => true
> }
>
> And it''s working, but... I need this refreshment before any other
> packages will be installed. How to do that, without adding
"before"
> statement to all pacakges definitions I write?
Use a global default "Package{ require => Exec["AptUpdate"]
}" Take care
though, that this might be overriden, when you specify additional
dependencies on resources.
Regards, DavidS>
> bye
> ---
> Grzegorz Marszałek
> graf0@post.pl
>
>
> _______________________________________________
> Puppet-users mailing list
> Puppet-users@madstop.com
> https://mail.madstop.com/mailman/listinfo/puppet-users
- --
The primary freedom of open source is not the freedom from cost, but the free-
dom to shape software to do what you want. This freedom is /never/ exercised
without cost, but is available /at all/ only by accepting the very different
costs associated with open source, costs not in money, but in time and effort.
- -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHWVgT/Pp1N6Uzh0URAsY1AJwOlSf052BDFMalgYHDxzVT9jfKUACfdBLT
HVmWLl3ab73P6phFdgERsns=N88g
-----END PGP SIGNATURE-----