How Activate and Enable Repos via command line on Satellite 6.x

in satelite •  7 years ago  (edited)
  1. Connect to you server via ssh

ssh [email protected]

2.- Execute the hammer cli

hammer --username "username of satellite admin account" --password "password" shell

3.- Obtain List of Organizations
hammer> organization list

IDNAMELABELDESCRIPTION
1Default_OrganizationDefault_OrganizationDefault_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 [email protected]

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

IDTYPENAME
2024yumRed Hat Enterprise Linux 4 ES (Source RPMs)
861fileRed Hat Enterprise Linux 5 Server Beta (Source ISOs)
3535yumRed Hat Enterprise Linux 5 Server Beta - Optional Productivity Applications (Debug RPMs)
3025fileRed 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

IDNAMELABELDESCRIPTION
1Default_OrganizationDefault_OrganizationDefault_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

  1. -Get the repolist

hammer> repository list --organization-id 1

IDNAMEPRODUCTCONTENT TYPEURL
4Puppet MasterPuppet Modulespuppet
1Red Hat Enterprise Linux 6 ServerRed Hat Enterprise Linux Serveryumhttps://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.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!