Project

General

Profile

Actions

Feature #1194

closed

Support hooking into host creation/deletion

Added by Benjamin Goldsbury over 12 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Plugin integration
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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 2 (0 open2 closed)

Related to Foreman - Feature #1353: Foreman should be able to handle pre and post hook action.ClosedJoseph Magen11/24/2011Actions
Related to Foreman - Feature #58: trigger actions when a New sucessful host is addedClosedJoseph Magen11/03/2009Actions
Actions #1

Updated by Ohad Levy over 12 years 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)

Actions #2

Updated by Benjamin Goldsbury over 12 years 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.

Actions #3

Updated by Ohad Levy over 12 years 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?

Actions #4

Updated by Benjamin Goldsbury over 12 years ago

I think notification through the UI is a reasonable starting place.

Actions #5

Updated by Ohad Levy almost 12 years ago

following a discussion on irc
here is an example http://pastie.org/3888211

Actions #6

Updated by marcelo veglienzone over 11 years ago

I would like to see something like this to have foreman update freeipa upon host creation

Actions #7

Updated by Joseph Magen over 11 years 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

https://github.com/isratrade/foreman_plugin_template/blob/master/app/models/foreman_plugin_template/host_extensions.rb

module HostExtensions
  extend ActiveSupport::Concern

  included do
    execute standard callbacks
    after_create :do_this
    after_destroy :do_that

    execute custom hooks
    after_ready_for_build :do_something_special_after_build
    def do_something_special_after_build
      p "doing customized callback something special AFTER build" 
    end
  end
end

Actions #8

Updated by Ohad Levy over 11 years ago

  • Category set to Plugin integration
  • Status changed from New to Resolved
  • Assignee set to Joseph Magen
  • Target version set to 1.1
Actions

Also available in: Atom PDF