Hammer cheat sheet

Updated -

An overview of essential Hammer commands for Red Hat Satellite 6.2

For Satellite 6.2

Hammer is a command-line tool provided with Red Hat Satellite 6. You can use Hammer to configure and manage a Red Hat Satellite Server through either CLI commands or automation in shell scripts. The following cheat sheet provides a condensed overview of essential Hammer commands. See the Hammer CLI Guide for more information on Hammer.

General information
--help Display hammer commands and options, append after a subcommand to get more information
org The setting is organization-specific, append --organization org_name, or set default organization with: hammer defaults add --param-name \
organization_id --param-value org_ID

(Satellite 6.2 only)
loc The setting is location-specific, append --location loc_name, or set default loction with: hammer defaults add --param-name location_id \
--param-value loc_ID

(Satellite 6.2 only)
Note: This cheat sheet assumes saved credentials in ~/.hammer/cli_config.yml. See the Authentication section of the Hammer CLI Guide for more information.
Organizations, Locations, and Repositories
Subcommand Description and Tasks
Create an organization
hammer organization create \
--name org_name

List organizations
hammer organization list

location See the options for organization
Upload a subscription manifest
hammer subscription upload \
--file path
Enable a repository
hammer repository-set enable \
--product "prod_name" \
--basearch "base_arch" \
--releasever "rel_v" \
--name "repo_name"

Synchronize a repository
hammer repository synchronize \
--product "prod_name" \
--name "repo_name"

Create a custom repository
hammer repository create \
--product "prod_name" \
--content-type cont_type \
--publish-via-http true \
--url "repo_url" --name "repo_name"

Upload content to a custom repository
hammer repository upload-content \
--product "prod_name" \
--id "repo_id" --path "path_to_dir"

Content life cycle
Subcommand Description and Tasks
Create a life cycle environment
hammer lifecycle-environment \
create --name env_name \
--description "env_desc" \
--prior prior_env_name

List life cycle environments
hammer lifecycle-environment \

Create a content view
hammer content-view create \
--name cv_n \
--repository-ids repo_ID1,... \
--description "cv_description"

Add repositories to a content view
hammer content-view \
add-repository \
--name cv_n \
--repository-id repo_ID

Add Puppet modules to a content view
hammer content-view \
puppet-module add \
--content-view cv_n \
--name module_name

Publishing a content view
hammer content-view publish \
--id cv_ID

Publishing a content view
hammer content-view version \
promote --content-view cv_n \
--to-lifecycle-environment \

Incremental update of a content view
hammer content-view version \
incremental-update \
--content-view-version-id \
cv_ID --packages pkg_n1,... \
--environment-ids env_ID1,...

Provisioning environment
Subcommand Description and Tasks
domain Create a domain
hammer domain create \
--name domain_name
Add a subnet
hammer subnet create \
--name subnet_name \
--organization-ids org_ID1,... \
--location-ids loc_ID1,... \
--domain-ids dom_ID1,... \
--boot-mode boot_mode \
--network network_address \
--mask netmask --ipam ipam
Create a compute resource
hammer compute-resource create \
--name cr_name \
--organization-ids org_ID1,...
--location-ids loc_ID1,... \
--provider provider_name
medium Add an installation medium
hammer medium create \
--name med_name\
--path path_to_medium
partition-table Add a partition table
hammer partition-table create \
--name tab_name\
--path path_to_file \
--os-family os_family
template Add a provisioning template
hammer template create \
--name tmp_name\
--file path_to_template
os Add an operating system
hammer os create --name os_name\
--version version_num
Activation Keys
Subcommand Description and Tasks
Create an activation key
hammer activation-key create \
--name ak_name \
--content-view cv_n \
--lifecycle-environment lc_name
Add a subscription to the activation key
hammer activation-key \
add-subscription --id ak_ID \
--subscription-id sub_ID
Users and Permissions
Subcommand Description and Tasks
Create a user
hammer user create --login user_name \
--mail user_mail --auth-source-id 1 \
--organization-ids org_ID1,org_ID2...

Add a role to a user
hammer user add-role --id user_id \
--role role_name

Create a user group
hammer user-group create \
--name ug_name

Add a role to a user group
hammer user-group add-role --id ug_id \
--role role_name

role Create a role
hammer role create --name role_name
Create a filter and add it to a role
hammer filter create --name role_name \
--permission-ids perm_ID1,perm_ID2...
Subcommand Description and Tasks
erratum List errata
hammer erratum list

Find erratum by CVE
hammer erratum list --cve CVE

Inspect erratum
hammer erratum info --id err_ID

host List errata applicable to a host
hammer host errata list \
--host host_name

Apply errata to a host
hammer host errata apply \
--host host_name \
--errata-ids err_ID1,err_ID2...

Docker containers
Subcommand Description and Tasks
docker Create a container
hammer docker container create \
--name container_name \
--compute-resource-id cr_ID \
--repository-name repo_name \
--tag tag --command command

Start a container
hammer docker container start \
--id cont_ID

Subcommand Description and Tasks
Create a host group
hammer hostgroup create \
--name "hg_name" \
--environment "env_name" \
--architecture "arch_name" \
--domain domain_name \
--subnet subnet_name \
--puppet-proxy proxy_name \
--puppet-ca-proxy ca-proxy_name \
--operatingsystem "os_name" \
--partition-table "table_name" \
--medium "medium_name" \
--organization-ids org_ID1... \
--location-ids loc_ID1...

Add an activation key to a host group
hammer hostgroup set-parameter \
--hostgroup "hg_name" \
--name "kt_activation_keys" \
--value key_name

Create a host (inheriting parameters from a host group)
hammer host create \
--name "host_name" \
--hostgroup "hg_name" \
--interface="primary=true, \
mac=mac_addr, ip=ip_addr, " \
provision=true \
--organization-id org_ID \
--location-id loc_ID \
--ask-root-password yes
Add a job template for remote execution
hammer job-template create \
--file "path" --name "template_name" \
--provider-type SSH --job-category \
Invoke a remote job
hammer job-invocation create \
--job-template "template_name" \
--inputs key1="value",... \
--search-query "query"

Monitor the remote job
hammer job-invocation output \
--id job_id --host host_name

Subcommand Description and Tasks
task List all tasks
hammer task list

Monitor progress of a running task
hammer task progress --id task_ID


Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.