FHCAP Command Line Tool

For detailed help and documentation relating to fhcap-cli, please see FHCAP Command Line Tool fhcap-cli


Add this line to your application's Gemfile:

gem 'fhcap-cli'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fhcap-cli

The gem itself has quite a few dependencies, to help speed up installation you could skip the docs:

$ gem install fhcap-cli --no-ri --no-doc


$ fhcap setup

This creates a new fhcap config, clones required repos and sets up knife based on information in the config. By default it will create a structure similar to the following in your home directory:

|-- fhcap
|   |-- .chef
|   |   |-- bob
|   |   |-- knife-bob.rb
|   |   `-- knife.rb -> /home/hadmin/fhcap/.chef/knife-bob.rb
|   |-- repos
|   |   |-- fhcap
|   |   |-- fhcap-dev
|-- .fhcap
|   `-- fhcap.json

If you want to specify a different repos directory, you can do this by passing it in as an option:

fhcap setup --repos-dir /Users/mnairn/src

or, run setup in interactive mode and change it when prompted:

fhcap setup -i
Local directory where repos will be checked out (/Users/mnairn/src) /Users/mnairn/some_other_repo_dir

The default 'fh-src-dir' is set to ~/fhcap/repos, if you already have fh component src checked out or want to use a different directory, you can pass it as an option:

fhcap setup --fh-src-dir /Users/mnairn/src/fheng

or, run setup in interactive mode and change it when prompted:

bundle exec fhcap setup -i
Local directory where FH component src repos are checked out (/Users/mnairn/src/fheng)

knife setup (chef server)

After the initial setup, you will need to copy your own chef server credentials into the correct knife directories in order to gain proper access to a chef server.

During setup you will see output like this:

     missing  /home/hadmin/fhcap/.chef/bob/chef-validator.pem
     missing  /home/hadmin/fhcap/.chef/bob/hadmin.pem

This indicates that the required pem files for that particular knife configuration are missing. You need to retrieve these files form your chef server and copy them to the locations specified.

Add data repos (fhcap_prod etc..)

fhcap repo help add


fhcap repo add --name fhcap_prod --url [email protected]:feedhenry-ops/fhcap_prod.git --clusters-dir organisations

Add chef servers (trigger etc..)

fhcap knife help add


fhcap knife add --name trigger --url https://trigger.feedhenry.net

Add any required pem files listed as 'missing'

Add providers (aws,openstack etc..)

fhcap provider help add


fhcap provider add --name os1internal --type openstack --credentials os-auth-url:'http://control.os1.phx2.redhat.com:5000/v2.0' os-tenant-id:aa6c957ba2aa4368a8c385d07b7ab9da os-tenant-name:'Red Hat Mobile'
fhcap provider add --name fheng --type aws

A prompt will be displayed for any credentials that are required but not passed to the command directly


There is help included with the fhcap help subcommand which will list all subcommands and their usage:

fhcap help cluster


Install dependencies:

bundle install

Run commands in dev:

bundle exec fhcap setup

Run tests:


To install this gem onto your local machine, run bundle exec rake install.

To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.


  1. Fork it ( https://github.com/[my-github-username]/fhcap-cli/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request