Fhcap::Cli

FHCAP Command Line Tool

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

Installation

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

Setup

$ 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:

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

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
fh-src-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

Examples:

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

Examples:

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

Examples:

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

Usage

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

fhcap help cluster

Development

Install dependencies:

bundle install

Run commands in dev:

bundle exec fhcap setup

Run tests:

rspec

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.

Contributing

  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