Let’s learn how to create an organization and location on Foreman/Satellite server using the hammer command-line-interface.

In this example, I’m going to create an organization called: Operation and assign its location to Boston.

On the Foreman server, excute the following commands:

[root@foreman ~]# hammer organization create --name Operations
Organization created.
[root@foreman ~]# hammer location create --name Boston
Location created.
[root@foreman ~]# hammer organization add-location --name Operations \
> --location Boston
The location has been associated.

Let’s verify it:

[root@foreman ~]# hammer organization list
---|----------------------|----------------------|-------------|---------------------
ID | TITLE                | NAME                 | DESCRIPTION | LABEL
---|----------------------|----------------------|-------------|---------------------
1  | Default Organization | Default Organization |             | Default_Organization
5  | Operations           | Operations           |             | Operations
---|----------------------|----------------------|-------------|---------------------
[root@foreman ~]# hammer location list
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
6  | Boston           | Boston           |
2  | Default Location | Default Location |
---|------------------|------------------|------------

If you want to learn more on what else it could be done with hammer CLI, I strongly recommend that you visit this link Foreman & Katello 2.x Full Setup Guide - Part 1 directly.

Reference: