Hook script issue

Hi,

I'm trying to use hook scripts do do some extra stuff when a host gets
added in forman.

I created a script to react to create events (in
config/hooks/host/managed/create ) that sucessfully pre provisions my hosts
in ipa, and puts the one time password generated during the ipa add host
operation in a variable in foreman for use during bootstrapping.

However, I also want to re prevision the host when it gets rebuild. This is
a frequent occurence, as we are doing very active devolopment here at the
moment (every host gets rebuild on average about once a week…)

I though I could do this by dropping a script in
config/hooks/host/managed/update. This hook gets triggered when I do a
rebuild. However, this script gets also triggered when I change something
in the host config, and also when the host signals itself to Foreman after
the first build…

So I can't use this. Is there another hook I can use, one that only gets
triggered by a rebuild?

Krist

host/managed/after_build will get called when a host is put into build mode.

··· On 09/12/13 15:18, Krist van Besien wrote: > Hi, > > I'm trying to use hook scripts do do some extra stuff when a host gets > added in forman. > > I created a script to react to create events (in > config/hooks/host/managed/create ) that sucessfully pre provisions my > hosts in ipa, and puts the one time password generated during the ipa > add host operation in a variable in foreman for use during bootstrapping. > > However, I also want to re prevision the host when it gets rebuild. This > is a frequent occurence, as we are doing very active devolopment here at > the moment (every host gets rebuild on average about once a week...) > > I though I could do this by dropping a script in > config/hooks/host/managed/update. This hook gets triggered when I do a > rebuild. However, this script gets also triggered when I change > something in the host config, and also when the host signals itself to > Foreman after the first build... > > So I can't use this. Is there another hook I can use, one that only gets > triggered by a rebuild?


Dominic Cleal
Red Hat Engineering

Thanks. That did it. I also noticed that the JSON passed to the script
contains a "build" parameter I can use as an extra check,. to avoid that a
host gets removed from IPA when it isn't being rebuild…

Krist

··· On Monday, December 9, 2013 4:26:06 PM UTC+1, Dominic Cleal wrote: > > > > host/managed/after_build will get called when a host is put into build > mode. > >