Hello,
I need to be able to execute some puppet statements at the end of an 
automatic installation, essentially packages removal. But I don''t want 
it to be executed later.
I''m looking on a way to test tag definition into my default node but
did
not find it. What I would like to do is sort of:
node default {
     if tagged("bootstrap") {
         include bootstrap
     }
}
so that "puppetd --test --tags bootstrap" matches, whereas
"puppetd
--test" does not.
How could I achieve this ?
Regards,
JB
-- 
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.
Jean Baptiste FAVRE <jean.baptiste.favre@gmail.com> writes:> I need to be able to execute some puppet statements at the end of an automatic > installation, essentially packages removal. But I don''t want it to be executed > later.The main question to answer is: why not? This makes your configuration non-deterministic, which makes it vastly harder to express to puppet. If you tell us why you want to do this, though, we might be able to suggest a better approach that solves your problem. :) Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- 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.
Hello, Seems I wasn''t clear enough ;-) I defined few steps in puppet configuration. - The first one will be executed at the end of installation. It mainly consist in packages removal and is called "bootstrap". - The other ones will be executed after and consist in all other operations. While performing some tests, I figure out that, for one node, one of the package (let''s call it package_A) I removed in first step is re-installed because of dependency. I''m fine with that except that this package_A will be purged during next puppet run as well as the package I need to be installed. The run after will reinstall packages, the next one will remove them, etc... Basically, I''ve got 2 solutions: 1. keep package_A on all nodes 2. find a way to execute first step once, and once only. As you can guess, I''m trying to use second one :) In order to be able to apply my "bootstrap", I''ve included it in my default node from which all others inherit. Now I need to find a way to execute: - Bootstrap step only at the beginning - all steps but bootstrap after. I tried tags (maybe wrongly) without success and that''s why I''m asking to the list. Regards, JB Le 24/08/2010 01:52, Daniel Pittman a écrit :> Jean Baptiste FAVRE<jean.baptiste.favre@gmail.com> writes: > >> I need to be able to execute some puppet statements at the end of an automatic >> installation, essentially packages removal. But I don''t want it to be executed >> later. > > The main question to answer is: why not? This makes your configuration > non-deterministic, which makes it vastly harder to express to puppet. > > If you tell us why you want to do this, though, we might be able to suggest a > better approach that solves your problem. :) > > Daniel >-- 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.
Jean Baptiste FAVRE <jean.baptiste.favre@gmail.com> writes:> Hello, Seems I wasn''t clear enough ;-)Well, or I wasn''t smart enough. ;) [...]> While performing some tests, I figure out that, for one node, one of the > package (let''s call it package_A) I removed in first step is re-installed > because of dependency. > > I''m fine with that except that this package_A will be purged during next > puppet run as well as the package I need to be installed. The run after will > reinstall packages, the next one will remove them, etc... > > Basically, I''ve got 2 solutions: > 1. keep package_A on all nodes > 2. find a way to execute first step once, and once only. > > As you can guess, I''m trying to use second one :)*nod* I would suggest one of two things: One, find a way to declare that relationship statically to puppet rather than dynamically, so that you don''t get the cycle. Options there include using a custom fact to determine if the package should be removed or not, using a variable set on the node, or whatever. Two, move the problem outside of puppet: you want this bootstrap to run once, right? Can you get your node installation tool (we use people, FWIW) to run that script once: Step ten: execute ''wget -O- http://whatever/bootstrap | /bin/sh'' ...or even use puppet: exec { ''wget -O- http://whatever/bootstrap | /bin/sh'': creates => ''/var/lock/bootstrap-run'' } My preference is to use a "run once" script called by the SysV init process that does the bootstrap operation, but whatever. Oh, and that can be a puppet manifest if you want to stay coherent: you can invoke puppet directly on a manifest without going through the central server, so you don''t have to resort to shell commands to make it work. :) Regards, Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- 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.
Hello,
I finally found a way to get things done the way I want.
Daniel, thanks for your answer which pointed me the solution:
class bootstrap {
     if ($bootstrap_step){
         ... everything you want to do at this stage ...
     }
}
node default {
     include bootstrap
}
And in post-install actions in preseed/kickstart, just execute:
FACTER_bootstrap_step=true puppetd --test --server puppetsrv.domain.com
Regards,
JB
Le 24/08/2010 09:55, Daniel Pittman a écrit :> Jean Baptiste FAVRE<jean.baptiste.favre@gmail.com>  writes:
>
>> Hello, Seems I wasn''t clear enough ;-)
>
> Well, or I wasn''t smart enough. ;)
>
> [...]
>
>> While performing some tests, I figure out that, for one node, one of
the
>> package (let''s call it package_A) I removed in first step is
re-installed
>> because of dependency.
>>
>> I''m fine with that except that this package_A will be purged
during next
>> puppet run as well as the package I need to be installed. The run after
will
>> reinstall packages, the next one will remove them, etc...
>>
>> Basically, I''ve got 2 solutions:
>> 1. keep package_A on all nodes
>> 2. find a way to execute first step once, and once only.
>>
>> As you can guess, I''m trying to use second one :)
>
> *nod*  I would suggest one of two things:
>
> One, find a way to declare that relationship statically to puppet rather
than
> dynamically, so that you don''t get the cycle.  Options there
include using a
> custom fact to determine if the package should be removed or not, using a
> variable set on the node, or whatever.
>
> Two, move the problem outside of puppet: you want this bootstrap to run
once,
> right?  Can you get your node installation tool (we use people, FWIW) to
run
> that script once:
>
>      Step ten: execute ''wget -O- http://whatever/bootstrap |
/bin/sh''
>
> ...or even use puppet:
>
>      exec { ''wget -O- http://whatever/bootstrap |
/bin/sh'':
>          creates =>  ''/var/lock/bootstrap-run''
>      }
>
> My preference is to use a "run once" script called by the SysV
init process
> that does the bootstrap operation, but whatever.
>
>
> Oh, and that can be a puppet manifest if you want to stay coherent: you can
> invoke puppet directly on a manifest without going through the central
server,
> so you don''t have to resort to shell commands to make it work. :)
>
> Regards,
>          Daniel
>
-- 
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.