Feature #1194
Support hooking into host creation/deletion
| Status: | Resolved | Start: | 09/29/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 0% |
||
| Category: | Plugins-Engines | |||
| Target version: | 1.1 | |||
| Backlog: | No | Difficulity: | ||
| Votes: | 1 (View) |
Description
Since the goal of Foreman is to support life-cycle management, it should have support for doing business-specific tasks based.
For example, we generate custom SSL certificates for various services on each host we run. While this could be accomplished in Puppet, it seems that Foreman is the more logical place to control this behavior.
This could be accomplished via a plugin architecture or just an option of "script to run when creating a host" and "script to run when deleting a host".
Related issues
| related to Foreman - Feature #1353: Foreman should be able to handle pre and post hook action. | Closed | 11/24/2011 | ||
| related to Foreman - Feature #58: trigger actions when a New sucessful host is added | Closed | 11/03/2009 |
History
Updated by Ohad Levy over 1 year ago
would a simple script executed by foreman user would suffice?
at the moment, since there are is no background processing in foreman, the request would block the UI (e.g. the UI would wait until the script would finish)
Updated by Benjamin Goldsbury over 1 year ago
Seems fine to me. Would be nice if Foreman could capture stdout/stderr and/or warn the user on a non-0 exit of the script.
Updated by Ohad Levy over 1 year ago
would you like to get a notice in the UI / email ?
who should be noticed? the owner of the host? the creator of the host?
Updated by Benjamin Goldsbury over 1 year ago
I think notification through the UI is a reasonable starting place.
Updated by Ohad Levy about 1 year ago
following a discussion on irc
here is an example http://pastie.org/3888211
Updated by marcelo veglienzone 10 months ago
I would like to see something like this to have foreman update freeipa upon host creation
Updated by Joseph Magen 5 months ago
You can implement hooking into host creation/deletion by writing a Foreman Plugin - http://theforeman.org/projects/foreman/wiki/Plugins
Just follow the example at http://theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin
1 module HostExtensions
2 extend ActiveSupport::Concern
3
4 included do
5 execute standard callbacks
6 after_create :do_this
7 after_destroy :do_that
8
9 execute custom hooks
10 after_ready_for_build :do_something_special_after_build
11 def do_something_special_after_build
12 p "doing customized callback something special AFTER build"
13 end
14 end
15 end
