opsmgr

A ruby client for opsmanager and related tools. Extracted from RelEng's release-engineeering-automation.

Prerequisites

Ruby

Install ruby on your machine. Two popular ways to install ruby and manage your ruby installations are:

The rest of these instructions assume you have already installed the correct ruby version and are familiar with its use.

Setup

Command-Line

Run:

gem install opsmgr

This will install the opsmgr Gem and all dependencies.

Within Ruby Code

To install, add this line to your Gemfile and run bundle install:

gem 'opsmgr'

Usage

From the Command-Line

To see a list of all available rake tasks:

  1. Create a Rakefile:

    require 'opsmgr/tasks'
    
  2. Run:

    rake -T
    

Within Ruby Code

Require the appropriate part of the opsmgr library. See below for the required files for each task.

Environment Configuration File

The expected location of the environment configuration file is ../environment/metadata. If you need to specify an alternative location, you can use either the ENV_CONFIG_FILE or ENV_DIRECTORY environment variables. If you use the ENV_DIRECTORY environment variable to point to a directory of configuration files, the files inside that directory must be named according to the name of the environment, with the extension .yml.

Example AWS and vSphere environment files are included in the gem.

Basic Deployment of Ops Manager with Rake Tasks

Clean existing environment

If you want to start fresh, you can clear out your environment completely:

WARNING: this destroys all VMs in the environment, including but not limited to Ops Manager, µBOSH and Runtime

Note: If you used the old version of opsmgr tasks to create this environment, then you need to use that version to clean it. The new version does not correctly clean out deployments from the old version.

bundle exec rake opsmgr:destroy[environment]

Download an Ops Manager Image

Obtain the Ops Manager Image you need from Pivotal Network. If you need a newer version than is available there, consult the Ops Manager team.

Prepare The Environment (AWS-only)

This will spin up a cloudformation stack; because it provisions an RDS instance, it can take around half an hour.

bundle exec rake opsmgr:prepare[environment]

Deploy the Ops Manager

You need to specify the path to the Ops Manager image you want to use/have just downloaded.

bundle exec rake opsmgr:install[environment,path_to_ops_manager_image]

Configure and Deploy Microbosh

You need to specify the major and minor version of Ops Manager in these commands.

<OM version> is the Ops Manager version. Opsmgr supports Ops Manager 1.4, 1.5, and 1.6.

<wait time> is number of minutes to wait for install, recommended wait time is 45

bundle exec rake opsmgr:add_first_user[environment,<OM version>]
bundle exec rake opsmgr:microbosh:configure[environment,<OM version>]
bundle exec rake opsmgr:trigger_install[environment,<OM version>,<wait time>]

Advanced Tasks

Export the installation from Ops Manager

<OM version> is the Ops Manager version. Opsmgr supports Ops Manager 1.4, 1.5, and 1.6.

<file name> local file name to save the exported installation file

bundle exec rake opsmgr:export_installation[environment,<OM version>,<file name>]

Import an installation to Ops Manager

<OM version> is the Ops Manager version. Opsmgr supports Ops Manager 1.4, 1.5, and 1.6.

<file name> local file name of the installation file to import

bundle exec rake opsmgr:import_installation[environment,<OM version>,<file name>]

Destroy only the Ops Manager VM

Commonly done when testing export/import scenarios

bundle exec rake opsmgr:destroy:opsmgr[environment]