Run puppet stages in Foreman

Hello everyone,

is it possible to "Run Stages" when using Foreman??

http://docs.puppetlabs.com/guides/language_guide.html
(See Run Stages)

Basically I would like to control the ordering of resource management in
puppet.

i.E.:

Define Stages:

stage { 'first': before => Stage['main'] }stage { 'last': require => Stage['main'] }

Assign stages to classes:

class {
'apt-keys': stage => first;
'sendmail': stage => main;
'apache': stage => last;
}

cheers, Cesar

You would need to do this in your manifests still, you can't specify the
run stage from Foreman as there's nowhere in Foreman to enter
metaparameters such as 'stage' for a class.

You could use a wrapper class that includes other classes with the
appropriate stage, then include this from Foreman.

http://theforeman.org/issues/1987

··· On 24/06/13 13:50, MrTeleBird wrote: > Hello everyone, > > is it possible to "Run Stages" when using Foreman?? > > http://docs.puppetlabs.com/guides/language_guide.html > (See Run Stages) > > > > Basically I would like to control the ordering of resource management in > puppet. > > i.E.: > > Define Stages: > > >stage { 'first': before => Stage['main'] } > stage { 'last': require => Stage['main'] }| > > > Assign stages to classes: > > >class { > 'apt-keys': stage => first; > 'sendmail': stage => main; > 'apache': stage => last; > } > > cheers, Cesar > >


Dominic Cleal
Red Hat Engineering

Or you can also add a parameter with name stage and then override it
foreman - it'll do the job

··· On Tuesday, June 25, 2013 2:03:50 PM UTC+3, Dominic Cleal wrote: > > On 24/06/13 13:50, MrTeleBird wrote: > > Hello everyone, > > > > is it possible to "Run Stages" when using Foreman?? > > > > http://docs.puppetlabs.com/guides/language_guide.html > > (See Run Stages) > > > > > > > > Basically I would like to control the ordering of resource management in > > puppet. > > > > i.E.: > > > > Define Stages: > > > > >stage { 'first': before => Stage['main'] } > > stage { 'last': require => Stage['main'] }| > > > > > > Assign stages to classes: > > > > >class { > > 'apt-keys': stage => first; > > 'sendmail': stage => main; > > 'apache': stage => last; > > } > > > > cheers, Cesar > > > > > You would need to do this in your manifests still, you can't specify the > run stage from Foreman as there's nowhere in Foreman to enter > metaparameters such as 'stage' for a class. > > You could use a wrapper class that includes other classes with the > appropriate stage, then include this from Foreman. > > http://theforeman.org/issues/1987 > > -- > Dominic Cleal > Red Hat Engineering >

Hey Andrei,

Do you have an example of this? I'm having trouble with getting run stages
working in Foreman. I have:

runstages/manifests/init.pp

class runstages {
# declare my run stages
stage { 'stage01': }
stage { 'stage02': }
stage { 'stage99': }
Stage['stage01'] -> Stage['stage02'] -> Stage['main'] ->
Stage['stage99']
}

Then I try and set a class to use 'stage99':

myfirewall/manifests.init.pp

include runstages
class myfirewall($stage = 'stage99') {

}

which results in:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Puppet::Parser::Compiler failed with error ArgumentError: Could not find
stage stage99 specified by Class[Myfirewall] on node cheri.example.com

I overrode the parameter in Foreman but no luck. Any ideas?

I've also tried taking the "myfirewall" class off the host in Foreman and
adding it to the runstages init.pp like:

runstages/manifests/init.pp

class runstages {
# declare my run stages
stage { 'stage01': }
stage { 'stage02': }
stage { 'stage99': }
Stage['stage01'] -> Stage['stage02'] -> Stage['main'] ->
Stage['stage99']

class {'myfirewall':
   stage => 'stage99',
}

}

but that works intermittently - sometimes I get "duplicate declaration
Class['Myfirewall']" and sometimes puppet runs clean. Driving me nutso.
Any examples you could provide would be awesome. Cheers.

··· On Wednesday, June 26, 2013 4:56:00 AM UTC-4, Andrei Burd wrote: > > Or you can also add a parameter with name stage and then override it > foreman - it'll do the job > > On Tuesday, June 25, 2013 2:03:50 PM UTC+3, Dominic Cleal wrote: >> >> On 24/06/13 13:50, MrTeleBird wrote: >> > Hello everyone, >> > >> > is it possible to "Run Stages" when using Foreman?? >> > >> > http://docs.puppetlabs.com/guides/language_guide.html >> > (See Run Stages) >> > >> > >> > >> > Basically I would like to control the ordering of resource management >> in >> > puppet. >> > >> > i.E.: >> > >> > Define Stages: >> > >> > >stage { 'first': before => Stage['main'] } >> > stage { 'last': require => Stage['main'] }| >> > >> > >> > Assign stages to classes: >> > >> > >class { >> > 'apt-keys': stage => first; >> > 'sendmail': stage => main; >> > 'apache': stage => last; >> > } >> > >> > cheers, Cesar >> > > >> >> You would need to do this in your manifests still, you can't specify the >> run stage from Foreman as there's nowhere in Foreman to enter >> metaparameters such as 'stage' for a class. >> >> You could use a wrapper class that includes other classes with the >> appropriate stage, then include this from Foreman. >> >> http://theforeman.org/issues/1987 >> >> -- >> Dominic Cleal >> Red Hat Engineering >> >