How Activate and Enable Repos via command line on Satellite 6.0

1. Connect to you server via ssh

# ssh root@satellite.example.com

2.- Execute the hammer cli

# hammer  --username <username of satellite admin account> --password  <password>  shell

3.- Obtain List of Organizations
hammer> organization list
ID | NAME                             | LABEL                            | DESCRIPTION    
---|--------------------------|-------------------------|------------------------------------------------------------------------------              
1    | Default_Organization | Default_Organization | Default_Organization Organization

4.- Upload manifest to Satellite 6.0

Generate a new manifest with the self-service Satellite Certificate generation tool https://access.redhat.com/tools/satcert  and upload the manifest file to you Satellite 6.0
Now execute the following command for activate you manifest to Satellite 6.0 server

hammer>subscription upload --file /root/manifest.zip --organization-id 1

Enable Repositories on Satellite 6.0

1.- Connect to you server via ssh

# ssh root@satellite.example.com

2.- Execute the hammer cli

#hammer  --username <username of satellite admin account> --password  <password>  shell

3.- Get product list

hammer> product list --organization-id 1

ID | NAME                                                                                                     |  DESCRIPTION | ORGANIZATION          | REPOSITORIES | SYNC STATE
---|------------------------------------------------------------------- -|-------------------|--------------------------|--------------------|-----------
2  | Red Hat Software Collections for RHEL Server                         |                                | Default_Organization | 0                              | not_synced
8  | Red Hat Enterprise Linux Load Balancer for RHEL Server     |                                | Default_Organization | 0                              | not_synced
12 | Red Hat Enterprise Linux Workstation                                         |                                | Default_Organization | 0                              | not_synced
5  | Red Hat Enterprise Linux Server                                                    |                                | Default_Organization | 0                              | not_synced

4.- Get repositories on the Product with the id

hammer>repository-set list --product-id 5

ID       | TYPE      | NAME                                                                                  
-------|-----------|------------------------------------------------------------------------------------------
2024 | yum       | Red Hat Enterprise Linux 4 ES (Source RPMs)                                            
861     | file      | Red Hat Enterprise Linux 5 Server Beta (Source ISOs)                                  
3535 | yum       | Red Hat Enterprise Linux 5 Server Beta - Optional Productivity Applications (Debug RPMs)
3025 | file      | Red Hat Enterprise Linux 6 Server - Extras (Images)                                    

5.- Enable Repository

repository-set enable --id 3025 --product-id 5 --organization-id 1 --releasever 6Server --basearch x86_64

Where:
id= is the repo that you want to add to Satellite 6.0
product-id = is the product where the repo is locate you can get that on point #3
organization-id= is the organization that we going to add the repo.
releasever= is the release product you want to obtain
basearch= is the architecture desire of the product x86_64 or i386

Synchronize repos

1.- Obtain List of Organizations

hammer> organization list

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

2.- Get product list

hammer> product list --organization-id 1

ID | NAME                                                                                                     |  DESCRIPTION | ORGANIZATION          | REPOSITORIES | SYNC STATE
---|------------------------------------------------------------------- -|-------------------|--------------------------|--------------------|-----------
2  | Red Hat Software Collections for RHEL Server                         |                                | Default_Organization | 0                              | not_synced
8  | Red Hat Enterprise Linux Load Balancer for RHEL Server     |                                | Default_Organization | 0                              | not_synced
12 | Red Hat Enterprise Linux Workstation                                         |                                | Default_Organization | 0                              | not_synced
5  | Red Hat Enterprise Linux Server                                                    |                                | Default_Organization | 0                              | not_synced

3. -Get the repolist

hammer> repository list --organization-id 1

ID | NAME                                                      | PRODUCT                                          | CONTENT TYPE | URL                                                                        
---|-------------------------------------------------------------------|------------|--------------------|------------------------------------------------------------------------------
4  | Puppet Master                                      | Puppet Modules                                | puppet       |                                                                            
1  | Red Hat Enterprise Linux 6 Server  | Red Hat Enterprise Linux Server | yum            |https://cdn.redhat.com/content/dist/rhel/server/6/6Server/x86_64/

4.- Execute hammer command to start the synchonization of the repo

hammer>repository synchronize --async --id 1 --organization-id 1 --product-id 5

Where:
id=The repository you want to sync.
Organization-id = The id of the organization that you want to sync the repo.
Product-id= The product channel where the repo is going to be sync.

Comments

Popular posts from this blog

How to clean all the foreman task and locked task

CentOS 7 Server Hardening Guide

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