Can I trigger orchestration even if there weren't any host changes?

Sometimes I need Foreman to send out new DHCP leases, or rewrite a PXE boot
file. I can trigger this by changing a host's IP or MAC address and then
changing it back, but that's kind of ugly.

Is there an API, and perhaps could there be a button, to trigger
orchestration steps even if there wasn't a host change?

On a small scale, sometimes I just need the host information to be pushed
out a second time. On a larger scale, I might need to push all DHCP and PXE
information out to a replacement smart proxy; it'd be nice to have a button
or two to push to make that happen in automated fashion.

Thanks!
Aaron

Hello,

this looks like reasonable idea, please file a feature request issue on
our tracker.

LZ

··· On Thu, Jan 09, 2014 at 02:58:49PM -0800, Aaron Stone wrote: > Sometimes I need Foreman to send out new DHCP leases, or rewrite a PXE boot > file. I can trigger this by changing a host's IP or MAC address and then > changing it back, but that's kind of ugly. > > Is there an API, and perhaps could there be a button, to trigger > orchestration steps even if there wasn't a host change? > > On a small scale, sometimes I just need the host information to be pushed > out a second time. On a larger scale, I might need to push all DHCP and PXE > information out to a replacement smart proxy; it'd be nice to have a button > or two to push to make that happen in automated fashion. > > Thanks! > Aaron > > -- > You received this message because you are subscribed to the Google Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

Yeah we need a few things like this. You can rewrite a PXE file by toggling
the Build button (but that wipes the facts/reports, ugly), and there was a
blog a while back on rewriting leases from the Rails console. Overall we
need what you're suggesting, as well as a larger redeploy-all feature to
rewrite e.g. all tftp files (globally or for a single proxy). Feature
requests would be welcome :slight_smile:

Greg

··· On Thu, Jan 09, 2014 at 02:58:49PM -0800, Aaron Stone wrote:

Sometimes I need Foreman to send out new DHCP leases, or rewrite a PXE
boot
file. I can trigger this by changing a host’s IP or MAC address and then
changing it back, but that’s kind of ugly.

Is there an API, and perhaps could there be a button, to trigger
orchestration steps even if there wasn’t a host change?

On a small scale, sometimes I just need the host information to be pushed
out a second time. On a larger scale, I might need to push all DHCP and
PXE
information out to a replacement smart proxy; it’d be nice to have a
button
or two to push to make that happen in automated fashion.

Thanks!
Aaron

http://projects.theforeman.org/issues/4006

I'll start working on the code now :slight_smile:

··· On Mon, Jan 13, 2014 at 3:08 AM, Greg Sutcliffe wrote:

On Thu, Jan 09, 2014 at 02:58:49PM -0800, Aaron Stone wrote:

Sometimes I need Foreman to send out new DHCP leases, or rewrite a PXE
boot
file. I can trigger this by changing a host’s IP or MAC address and then
changing it back, but that’s kind of ugly.

Is there an API, and perhaps could there be a button, to trigger
orchestration steps even if there wasn’t a host change?

On a small scale, sometimes I just need the host information to be
pushed
out a second time. On a larger scale, I might need to push all DHCP and
PXE
information out to a replacement smart proxy; it’d be nice to have a
button
or two to push to make that happen in automated fashion.

Thanks!
Aaron

Yeah we need a few things like this. You can rewrite a PXE file by
toggling the Build button (but that wipes the facts/reports, ugly), and
there was a blog a while back on rewriting leases from the Rails console.
Overall we need what you’re suggesting, as well as a larger redeploy-all
feature to rewrite e.g. all tftp files (globally or for a single proxy).
Feature requests would be welcome :slight_smile:

Greg


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

The top-level of the orchestration system appears to be
app/observers/host_observer.rb, and then individual orchestrations register
as after_validation hooks. I'm looking into how to trigger the
after_validations, ideally without having to call host.save.

··· On Mon, Jan 13, 2014 at 11:52 AM, Aaron Stone wrote:

Feature #4006: Re-perform orchestration steps for a host - Foreman

I’ll start working on the code now :slight_smile:

On Mon, Jan 13, 2014 at 3:08 AM, Greg Sutcliffe greg.sutcliffe@gmail.comwrote:

On Thu, Jan 09, 2014 at 02:58:49PM -0800, Aaron Stone wrote:

Sometimes I need Foreman to send out new DHCP leases, or rewrite a
PXE boot
file. I can trigger this by changing a host’s IP or MAC address and
then
changing it back, but that’s kind of ugly.

Is there an API, and perhaps could there be a button, to trigger
orchestration steps even if there wasn’t a host change?

On a small scale, sometimes I just need the host information to be
pushed
out a second time. On a larger scale, I might need to push all DHCP
and PXE
information out to a replacement smart proxy; it’d be nice to have a
button
or two to push to make that happen in automated fashion.

Thanks!
Aaron

Yeah we need a few things like this. You can rewrite a PXE file by
toggling the Build button (but that wipes the facts/reports, ugly), and
there was a blog a while back on rewriting leases from the Rails console.
Overall we need what you’re suggesting, as well as a larger redeploy-all
feature to rewrite e.g. all tftp files (globally or for a single proxy).
Feature requests would be welcome :slight_smile:

Greg


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

Good question - our orchestration is tied to activerecord. I guess you
can save, but it will update last_changed column (which we can live with
I guess).

LZ

··· On Tue, Jan 14, 2014 at 01:10:36PM -0800, Aaron Stone wrote: > The top-level of the orchestration system appears to be > app/observers/host_observer.rb, and then individual orchestrations register > as after_validation hooks. I'm looking into how to trigger the > after_validations, ideally without having to call host.save. > > > On Mon, Jan 13, 2014 at 11:52 AM, Aaron Stone wrote: > > > http://projects.theforeman.org/issues/4006 > > > > I'll start working on the code now :) > > > > > > > > On Mon, Jan 13, 2014 at 3:08 AM, Greg Sutcliffe wrote: > > > >> On Thu, Jan 09, 2014 at 02:58:49PM -0800, Aaron Stone wrote: > >> > >>> > Sometimes I need Foreman to send out new DHCP leases, or rewrite a > >>> PXE boot > >>> > file. I can trigger this by changing a host's IP or MAC address and > >>> then > >>> > changing it back, but that's kind of ugly. > >>> > > >>> > Is there an API, and perhaps could there be a button, to trigger > >>> > orchestration steps even if there wasn't a host change? > >>> > > >>> > On a small scale, sometimes I just need the host information to be > >>> pushed > >>> > out a second time. On a larger scale, I might need to push all DHCP > >>> and PXE > >>> > information out to a replacement smart proxy; it'd be nice to have a > >>> button > >>> > or two to push to make that happen in automated fashion. > >>> > > >>> > Thanks! > >>> > Aaron > >>> > >> > >> Yeah we need a few things like this. You can rewrite a PXE file by > >> toggling the Build button (but that wipes the facts/reports, ugly), and > >> there was a blog a while back on rewriting leases from the Rails console. > >> Overall we need what you're suggesting, as well as a larger redeploy-all > >> feature to rewrite e.g. all tftp files (globally or for a single proxy). > >> Feature requests would be welcome :) > >> > >> Greg > >> > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Foreman users" group. > >> To unsubscribe from this group and stop receiving emails from it, send an > >> email to foreman-users+unsubscribe@googlegroups.com. > >> To post to this group, send email to foreman-users@googlegroups.com. > >> Visit this group at http://groups.google.com/group/foreman-users. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > > > > > > -- > You received this message because you are subscribed to the Google Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

I wonder if the thing to do here is split the foreman orchestration from
the activerecord callbacks.

The top-level Orchestration concern model adds 'after_validation
:queue_orchestrations' and then in each orchestration model, switch from
'after_validation :orchestrate_foo' to 'orchestrate :foo'.

This would allow a call to do_orchestrations at any time, and perhaps list
the orchestrations registered for a given model (e.g. for a preview of
orchestration actions before saving the Host model). Finally, as
Orchestration has a before_save callback that calls 'process :queue', the
hypothetical do_orchestrations would also call process :queue on the object
we're re-running.

All that said, there's a run_callback method in activesupport. I wonder if
I could do something like this:

host = Host.find('my host')
host.run_callbacks :after_validation
host.process :queue

…hmm, this doesn't work in a rails console.

··· On Thu, Jan 16, 2014 at 12:19 AM, Lukas Zapletal wrote:

Good question - our orchestration is tied to activerecord. I guess you
can save, but it will update last_changed column (which we can live with
I guess).

LZ

On Tue, Jan 14, 2014 at 01:10:36PM -0800, Aaron Stone wrote:

The top-level of the orchestration system appears to be
app/observers/host_observer.rb, and then individual orchestrations
register
as after_validation hooks. I’m looking into how to trigger the
after_validations, ideally without having to call host.save.

On Mon, Jan 13, 2014 at 11:52 AM, Aaron Stone sodabrew@gmail.com > wrote:

Feature #4006: Re-perform orchestration steps for a host - Foreman

I’ll start working on the code now :slight_smile:

On Mon, Jan 13, 2014 at 3:08 AM, Greg Sutcliffe < > greg.sutcliffe@gmail.com>wrote:

On Thu, Jan 09, 2014 at 02:58:49PM -0800, Aaron Stone wrote:

Sometimes I need Foreman to send out new DHCP leases, or rewrite a
PXE boot
file. I can trigger this by changing a host’s IP or MAC address and
then
changing it back, but that’s kind of ugly.

Is there an API, and perhaps could there be a button, to trigger
orchestration steps even if there wasn’t a host change?

On a small scale, sometimes I just need the host information to be
pushed
out a second time. On a larger scale, I might need to push all DHCP
and PXE
information out to a replacement smart proxy; it’d be nice to have
a

button

or two to push to make that happen in automated fashion.

Thanks!
Aaron

Yeah we need a few things like this. You can rewrite a PXE file by
toggling the Build button (but that wipes the facts/reports, ugly),
and

there was a blog a while back on rewriting leases from the Rails
console.

Overall we need what you’re suggesting, as well as a larger
redeploy-all

feature to rewrite e.g. all tftp files (globally or for a single
proxy).

Feature requests would be welcome :slight_smile:

Greg


You received this message because you are subscribed to the Google
Groups

“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it,
send an

email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

Not sure about running the whole validation set, but you can definitely run
individual orchestration actions, iirc. Something like

Host.all.each { |h| h.setTftp }

or something like that…

> I wonder if the thing to do here is split the foreman orchestration from
> the activerecord callbacks.

FYI folks from Katello team are working on orchestration engine called
Dynflow which was adopted as main orchestration engine for Katello
itself and there is chance we will adopt it in Foreman as well.

In addition to decoupling from activerecord, this would bring
orchestration in Foreman to the next level.

··· -- Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

Sure, but this means that my "Re-run the orchestrations" button needs to
explicitly call each orchestration. That defeats the dynamic registration
properties of the orchestration concerns, and means I cannot automatically
include any plugin orchestrations.

··· On Thu, Jan 16, 2014 at 2:32 AM, Greg Sutcliffe wrote:

Not sure about running the whole validation set, but you can definitely
run individual orchestration actions, iirc. Something like

Host.all.each { |h| h.setTftp }

or something like that…


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

This one? https://github.com/iNecas/dynflow

··· On Thu, Jan 16, 2014 at 3:12 AM, Lukas Zapletal wrote:

I wonder if the thing to do here is split the foreman orchestration from
the activerecord callbacks.

FYI folks from Katello team are working on orchestration engine called
Dynflow which was adopted as main orchestration engine for Katello
itself and there is chance we will adopt it in Foreman as well.

In addition to decoupling from activerecord, this would bring
orchestration in Foreman to the next level.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

Sure, I get where you're trying to go - I was just dredging up old memories
in an attempt to help. Sounds like you've already moved beyond that though
:smiley:

··· On 16 January 2014 10:34, Aaron Stone wrote:

Sure, but this means that my “Re-run the orchestrations” button needs to
explicitly call each orchestration. That defeats the dynamic registration
properties of the orchestration concerns, and means I cannot automatically
include any plugin orchestrations.

Thats the one. A few of us are playing with it at the moment for new/small
tasks (e.g. the foreman-tasks plugin makes report uploading from Puppet
asynchronous) and there's larger discussions in the works around async
stuff for MCollective, but I think it'll be a while before we get to
re-writing the host orchestration stuff.

··· On 16 January 2014 16:52, Aaron Stone wrote:

This one? https://github.com/iNecas/dynflow