Chapter 22. Command Line Reference

hammer is the CLI management tool for Red Hat Satellite functionality. It can:
  • Provision hosts.
  • Edit the attributes of a resource or group.
  • Interact and manipulate hosts, capsules and domains.
hammer can be executed on the command line through its parameters and options or through the interactive shell. To invoke the shell:

Example 22.1. Invoking the hammer Shell

[root@satellite.example.com ~]# hammer shell
Welcome to the hammer interactive shell
Type 'help' for usage information
Command completion is disabled on ruby < 1.9 due to compatibility problems.
hammer> organization list
---|------------------|------------------|------------------------------
ID | NAME             | LABEL            | DESCRIPTION
---|------------------|------------------|------------------------------
1  | ACME_Corporation | ACME_Corporation | ACME_Corporation Organization
3  | Test Corp        | Test_Corp        |
---|------------------|------------------|------------------------------
hammer>
The full list of options and subcommands are available in the help file:
# hammer -h

22.1. Configuring hammer

By default, if you run hammer from the command line, you need to enter your credentials for each operation. To avoid this, you can either use hammer shell as described in Example 22.1, “Invoking the hammer Shell” or you can create a configuration file in your home directory with your login credentials.

Important

Saving credentials in plain text files is a potential security risk. Take the necessary precautions to ensure your passwords and other sensitive information are protected.

Procedure 22.1. To Configure hammer to Use Saved Credentials:

  1. Create a ~/.hammer/cli_config.yml file if it does not already exist.
  2. Add the following contents to the file. Ensure you replace the example values with your own details.
    :foreman:
        :host: 'https://satellite.example.com/'
        :username: 'admin'
        :password: 'changeme'
  3. Save and close the file. Now when you run hammer it should not prompt you for your credentials.