Skip to content
Go to file
This branch is 29 commits ahead, 3 commits behind isratrade:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time



Gem Version

This gem will added a route to the API to return the name of available host(s)


You have to make sure that the gem is available to foreman, to do that the recommended way is to add a new file to $FOREMAN_DIR/bundler.d named foreman_reserve.rb with the next content:

  • You can use the git code to get the latest:

gem 'foreman_reserve', :git => ""
  • Or the gem from rubygems:

gem 'foreman_reserve'

After that you'll need to create the bundle for foreman, as foreman user run from the $FOREMAN_DIR:

>$ bunde --deploy

Foreman 1.1

In order to work, the foreman application must be the following two lines commented out.


# match '*a', :to => 'errors#routing'


# match '*other', :to => 'home#route_error'


To make a host 'reservable', you need to make sure it has a parameter named RESERVED, When this parameter is added it should be set to 'false'. This parameter will be used to store the current reservation status, you can safely add the parameter to a hostgroup for the host to inherit from.

To return 1 host:

>$ curl -u admin:secret -H 'accept:application/json'

To return multiple hosts, pass a parameter called 'amount'

>$ curl -u admin:secret -H 'accept:application/json'

Filter using a specific query: (name ~ virt%)

>$ curl -u admin:secret -H 'accept:application/json' ''

Release a specific host:

>$ curl -u admin:secret -H 'accept:application/json' ''

Release a group of hosts using a query: (name ~ virt%)

>$ curl -u admin:secret -H 'accept:application/json' ''


In order to use from python, there's a python module that already includes this plugin calls, you can find it on pypi or on github:

Contributing to foreman_reserve

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013 Joseph Mitchell Magen and David Caro. See LICENSE.txt for further details.






You can’t perform that action at this time.