How to create activation key and add the subcription and host collection via command hammer for Satellite 6 and Katello

Login into you katello or satellite

[root@satellite ~]# hammer shell
[Foreman] username: admin
[Foreman] password for admin:
Welcome to the hammer interactive shell
Type 'help' for usage information

get the organization list

---|----------------------|----------------------|----------------------------------
ID | NAME                 | LABEL                | DESCRIPTION                     
---|----------------------|----------------------|----------------------------------
1  | Default_Organization | Default_Organization | Default_Organization Organization
---|----------------------|----------------------|----------------------------------


Create the new activation key

activation-key create --name test --organization-id 1 --unlimited-content-hosts

Get the id for the new activation key

hammer> activation-key list --organization-id 1
---|------|----------|-----------------------|-------------
ID | NAME | CONSUMED | LIFECYCLE ENVIRONMENT | CONTENT VIEW
---|------|----------|-----------------------|-------------
2  | test | 0 of     |                       |            
---|------|----------|-----------------------|-------------

Get subscription list

hammer> subscription list --organization-id 1

-----------|---------
NAME                                      | CONTRACT | ACCOUNT | SUPPORT      | QUANTITY  | CONSUMED | END DATE   | ID                               | PRODUCT                                   | QUANTITY  | ATTACHED
------------------------------------------|----------|---------|--------------|-----------|----------|------------|----------------------------------|-------------------------------------------|-----------|---------
Red Hat Satellite 6 (For Transition Only) | 10533615 | 540155  | Premium      | 2         | 0        | 2015-09-12 | 4028fa684a4afee1014a4b3246d6004e | Red Hat Satellite 6 (For Transition Only) | 2         | 0      
Red Hat Employee Subscription             | 2595446  | 540155  | Self-Support | 10        | 0        | 2022-01-01 | 4028fa684a4afee1014a4b3423f100c2 | Red Hat Employee Subscription             | 10        | 0      
PuppetForge                               |          |         |              | Unlimited | 0        | 2044-12-01 | 4028fa684a2d41fa014a2d8c9b18001c | PuppetForge                               | Unlimited | 0      
------------------------------------------|----------|---------|--------------|-----------|----------|------------|----------------------------------|-------------------------------------------|-----------|---------
-----------|---------
NAME                                      | CONTRACT | ACCOUNT | SUPPORT      | QUANTITY  | CONSUMED | END DATE   | ID                               | PRODUCT                                   | QUANTITY  | ATTACHED
------------------------------------------|----------|---------|--------------|-----------|----------|------------|----------------------------------|-------------------------------------------|-----------|---------
Red Hat Satellite 6 (For Transition Only) | 10533615 | 540155  | Premium      | 2         | 0        | 2015-09-12 | 4028fa684a4afee1014a4b3246d6004e | Red Hat Satellite 6 (For Transition Only) | 2         | 0      
Red Hat Employee Subscription             | 2595446  | 540155  | Self-Support | 10        | 0        | 2022-01-01 | 4028fa684a4afee1014a4b3423f100c2 | Red Hat Employee Subscription             | 10        | 0      
PuppetForge                               |          |         |              | Unlimited | 0        | 2044-12-01 | 4028fa684a2d41fa014a2d8c9b18001c | PuppetForge                               | Unlimited | 0      
------------------------------------------|----------|---------|--------------|-----------|----------|------------|----------------------------------|-------------------------------------------|-----------|---------

Get the ID  of the subcription you want to attach 4028fa684a4afee1014a4b3423f100c2 

Add the subcription quantity to the new activation 

hammer> activation-key add-subscription --id 2  --quantity 1 --subscription-id 4028fa684a4afee1014a4b3423f100c2
Subscription added to activation key














Create the new host-collection

host-collection create --name example --organization-id 1 --unlimited-content-hosts

In case you want restricted the number of hosts

host-collection create --name example --organization-id 1  --max-content-hosts --max-content-hosts 10

Get the id of the new host-collection

hammer> host-collection list --organization-id 1
---|---------|-------|------------
ID | NAME    | LIMIT | DESCRIPTION
---|---------|-------|------------
2  | example |       |           
---|---------|-------|------------

Finally add the host-collection to the key to complete the procedure of the creation of the activation key.

hammer> activation-key add-host-collection --id 2 --organization-id 1 --host-collection-id 2
The host collection has been associated






Comments

Popular posts from this blog

How to clean all the foreman task and locked task

How to restrict users to send only mail to the local domain in Zimbra

Hardening Script