Skip to content
James Dickson edited this page Mar 18, 2021 · 80 revisions

CLI Manual

Use the following command to view the CLI Manual:

morpheus man

Use the morpheus man command to generate and read the CLI manual. The document is located at ~/.morpheus/CLI-Manual-5.0.0.md, depending on the version(s) you have installed.

Here is just the first part of what the CLI Manual document looks like:

NAME

morpheus - the command line interface for interacting with the Morpheus appliance

SYNOPSIS

morpheus [command] [<args>] [options]

DESCRIPTION

Morpheus CLI

This is a command line interface for managing a Morpheus Appliance.
All communication with the remote appliance is done via the Morpheus API.

To get started, see the command `remote add` command.

To learn more, visit https://github.com/gomorpheus/morpheus-cli/wiki/Getting-Started

To learn more about the Morpheus Appliance, visit https://www.morpheusdata.com

To learn more about the Morpheus API, visit https://apidocs.morpheusdata.com

GLOBAL OPTIONS

Morpheus supports a few global options.

-v, --version                    Print the version.
    --noprofile                  Do not read and execute the personal initialization script .morpheus_profile
-C, --nocolor                    Disable ANSI coloring
-V, --debug                      Print extra output for debugging. 
-h, --help                       Print this help

COMMON OPTIONS

There are some common options that many commands support. They work the same way for each command.

-O, --option OPTION              Option value in the format -O var="value" (deprecated soon in favor of first class options)
-N, --no-prompt                  Skip prompts. Use default values for all optional fields.
-j, --json                       JSON Output
-d, --dry-run                    Dry Run, print the API request instead of executing it
-r, --remote REMOTE              Remote Appliance Name to use for this command. The active appliance is used by default.
-I, --insecure                   Allow for insecure HTTPS communication i.e. bad SSL certificate       
-y, --yes                        Auto confirm, skip any 'Are you sure?' confirmations.
-r, --quiet                      No Output, when successful.

MORPHEUS COMMANDS

We divide morpheus into commands.  
Every morpheus command may have 0-N sub-commands that it supports. 
Commands generally map to the functionality provided in the Morpheus UI.
   
You can get help for any morpheus command by using the -h option.

The available commands and their options are also documented below.

morpheus

Usage: morpheus [command] [options]
Commands:
    access-token
    alias
    appliance-settings
    apps
    archives
    benchmark
    blueprints
    clouds
    clusters
    containers
    cypher
    datastores
    deploy
    deployments
    edit-profile
    edit-rc
    environments
    execute-schedules
    execution-request
    file-copy-request
    groups
    hosts
    image-builder
    instance-types
    instances
    key-pairs
    library-file-templates
    library-instance-types
    library-layouts
    library-node-types
    library-option-lists
    library-option-types
    library-scripts
    library-upgrades
    license
    load-balancers
    login
    logout
    logs
    monitor-alerts
    monitor-apps
    monitor-checks
    monitor-contacts
    monitor-groups
    monitor-incidents
    network-domains
    network-groups
    network-pool-servers
    network-pools
    network-proxies
    network-services
    networks
    passwd
    policies
    power-schedules
    process
    recent-activity
    remote
    reports
    resource-folders
    resource-pools
    roles
    security-groups
    shell
    storage-buckets
    tasks
    tenants
    user-groups
    user-settings
    user-sources
    users
    version
    virtual-images
    whoami
    wiki
    workflows
Options:
    -e, --exec EXPRESSION            Execute the command(s) expression. This is an alternative to passing [command] [options]
        --noprofile                  Do not read and execute the personal initialization script .morpheus_profile
    -C, --nocolor                    Disable ANSI coloring
    -B, --benchmark                  Print benchmark time after the command is finished.
    -V, --debug                      Print extra output for debugging.
    -v, --version                    Print the version.
    -h, --help                       Print this help

For more information, see https://github.com/gomorpheus/morpheus-cli/wiki

ENVIRONMENT VARIABLES

Morpheus has only one environment variable that it uses.

MORPHEUS_CLI_HOME

The MORPHEUS_CLI_HOME variable is where morpheus CLI stores its configuration files. This can be set to allow a single system user to maintain many different configurations If the directory does not exist, morpheus will attempt to create it.

The default home directory is $HOME/.morpheus

To see how this works, run the following:

MORPHEUS_CLI_HOME=~/.morpheus_test morpheus shell

Now, in your new morpheus shell, you can see that it is a fresh environment. There are no remote appliances configured.

morpheus> remote list

Morpheus Appliances
==================

You have no appliances configured. See the `remote add` command.

You can use this to create isolated environments (sandboxes), within which to execute your morpheus commands.

export MORPHEUS_CLI_HOME=~/morpheus_test
morpheus remote add demo https://demo.mymorpheus --insecure
morpheus instances list

Morpheus saves the remote appliance information, including api access tokens, to the $MORPHEUS_HOME_DIRECTORY. These files are saved with file permissions 6000. So, only one system user should be allowed to execute morpheus with that home directory. See Configuration for more information on the files morpheus reads and writes.

CONFIGURATION

Morpheus reads and writes several configuration files within the $MORPHEUS_CLI_HOME directory.

Note: These files are maintained by the program. It is not recommended for you to manipulate them.

appliances file

The appliances YAML file contains a list of known appliances, keyed by name.

Example:

:qa:
  :host: https://qa.mymorpheus
  :active: true
:production:
  :host: https://mymorpheus
  :active: false

credentials file

The .morpheus/credentials YAML file contains access tokens for each known appliance.

groups file

The .morpheus/groups YAML file contains the active group information for each known appliance.

Startup scripts

When Morpheus starts, it executes the commands in a couple of dot files.

These scripts are written in morpheus commands, not bash, so they can only execute morpheus commands and aliases.

.morpheus_profile file

It looks for $MORPHEUS_CLI_HOME/.morpheus_profile, and reads and executes it (if it exists).

This may be inhibited by using the --noprofile option.

.morpheusrc file

When started as an interactive shell with the morpheus shell command, Morpheus reads and executes $MORPHEUS_CLI_HOME/.morpheusrc (if it exists). This may be inhibited by using the --norc option.

An example startup script might look like this:

# .morpheusrc
set-prompt "%cyan%username%reset@%magenta%remote %cyanmorpheus> %reset"
version
remote current
echo "Welcome back %username"
echo