This article was originally published on the Red Hat Customer Portal. The information may no longer be current.
Overview
As a user of subscription-manager, I find myself frequently frustrated when running a subscription-manager list --all --available to find a specific subscription. As I am using an account that has a large number of subscriptions this is painful. And since each subscription has a varying amount of output associated with it, using grep (even with the -A switch) is painful. Ultimately, I end up piping the output via my PAGER (less|more|most) until I find the pool ID that I want. That is less than desirable.
This article covers some new options that are present in newer versions of subscription-manager to make dealing with subscriptions less painful.
Requirements
- subscription-manager >= 1.13.6-1 (What is included in RHEL >= 6.7 and >= 7.1)
- Red Hat Subscription Management (RHSM)
- Red Hat Satellite 6.1 or greater
Features
subscription-manager now has a --matches option which will match a variety of fields, varying with the list type:
- Installed
- Product Name
- Product ID
- Available
- Subscription Name
- Product Name & Product ID for each product listed under Provides:
- SKU
- Contract
- Service Level
- Consumed
- Subscription Name
- Product Name & Product ID for each product listed under Provides
- SKU
- Contract
- Service Level
Let's see it in action:
Use case 1
As a user, I want to find ALL subscriptions which have Red Hat Satellite in their name. (because everyone wants to install Satellite components, right?)
# subscription-manager list --available --matches 'Red Hat Satellite*'
+-------------------------------------------+
Available Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Satellite
Provides: Red Hat Satellite Capsule Beta
Red Hat Beta
Red Hat Software Collections (for RHEL Server)
Red Hat Satellite Capsule
Red Hat Satellite with Embedded Oracle
Red Hat Satellite 6 Beta
Red Hat Satellite Beta
Red Hat Enterprise Linux Server
Red Hat Enterprise Linux High Availability (for RHEL Server)
Red Hat Satellite
Red Hat Software Collections Beta (for RHEL Server)
Red Hat Enterprise Linux Load Balancer (for RHEL Server)
SKU: MCT0370
Contract: 11223344
Pool ID: 2c918f824e5ef0e8014e675ed46d0eeb
Provides Management: Yes
Available: 1
Suggested: 1
Service Level: Premium
Service Type: L1-L3
Subscription Type: Standard
Ends: 10/08/2016
System Type: Physical
Subscription Name: Red Hat Satellite Capsule Server
Provides: Red Hat Satellite Proxy
Red Hat Satellite Capsule Beta
Red Hat Beta
Red Hat Software Collections (for RHEL Server)
Red Hat Satellite Capsule
Red Hat Enterprise Linux Server
Red Hat Enterprise Linux High Availability (for RHEL Server)
Red Hat Software Collections Beta (for RHEL Server)
Red Hat Enterprise Linux Load Balancer (for RHEL Server)
SKU: MCT0369
Contract: 11223344
Pool ID: 2c918f824e5ef0e8014e675ed2e30e8c
Provides Management: Yes
Available: 5
Suggested: 1
Service Level: Premium
Service Type: L1-L3
Subscription Type: Standard
Ends: 10/08/2016
System Type: Physical
Use Case 2
As a (more advanced) user, show me all of the RH00004 - Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes) subscriptions that I own
#subscription-manager list --available --matches 'RH00004'
+-------------------------------------------+
Available Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)
Provides: Red Hat Container Images Beta
Red Hat Beta
Red Hat Software Collections (for RHEL Server)
Oracle Java (for RHEL Server)
Red Hat Enterprise Linux Atomic Host Beta
Red Hat Container Images
Red Hat Enterprise Linux Server
Red Hat Software Collections Beta (for RHEL Server)
Red Hat Enterprise Linux Atomic Host
Red Hat Developer Toolset (for RHEL Server)
SKU: RH00004
Contract: 11223344
Pool ID: 2c918f824e5ef0e8014e675ed7a10fc2
Provides Management: No
Available: 4
Suggested: 1
Service Level: Standard
Service Type: L1-L3
Subscription Type: Instance Based
Ends: 10/08/2016
System Type: Physical
Subscription Name: Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)
Provides: Red Hat Container Images Beta
Red Hat Beta
Red Hat Software Collections (for RHEL Server)
Oracle Java (for RHEL Server)
Red Hat Enterprise Linux Atomic Host Beta
Red Hat Container Images
Red Hat Enterprise Linux Server
Red Hat Software Collections Beta (for RHEL Server)
Red Hat Enterprise Linux Atomic Host
Red Hat Developer Toolset (for RHEL Server)
SKU: RH00004
Contract: 44332211
Pool ID: 2c918f824e5ef0e8014e675ed7320fa2
Provides Management: No
Available: 5
Suggested: 1
Service Level: Standard
Service Type: L1-L3
Subscription Type: Instance Based
Ends: 11/20/2016
System Type: Physical
Advanced usage 1:
In Satellite 6, when creating a custom product (under Content->Products), a subscription is created, allowing you to treat custom software exactly how you treat Red Hat software. Thus, subscription-manager (and our new handy-dandy --matches command) works for them too.
# subscription-manager list --available --matches 'Extra*'
+-------------------------------------------+
Available Subscriptions
+-------------------------------------------+
Subscription Name: Extra Packages for Enterprise Linux
Provides:
SKU: 1436175280816
Contract:
Pool ID: 2c918f824e5ef0e8014e62b7abcf0a02
Provides Management: No
Available: Unlimited
Suggested: 1
Service Level:
Service Type:
Subscription Type: Standard
Ends: 06/28/2045
System Type: Physical
Advanced usage 2
I want to search for (and attach) a Satellite Capsule Server subscription. As a review, we can use either '--matches MCT0369' OR '--matches Red Hat Satellite Capsule Server'. Your pick . We'll use the '--pool-only' switch to output just the pool ID and then pipe that to the attach subcommand.
#subscription-manager list --available --matches 'Red Hat Satellite Capsule Server'
+-------------------------------------------+
Available Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Satellite Capsule Server
Provides: Red Hat Satellite Proxy
Red Hat Satellite Capsule Beta
Red Hat Beta
Red Hat Software Collections (for RHEL Server)
Red Hat Satellite Capsule
Red Hat Enterprise Linux Server
Red Hat Enterprise Linux High Availability (for RHEL Server)
Red Hat Software Collections Beta (for RHEL Server)
Red Hat Enterprise Linux Load Balancer (for RHEL Server)
SKU: MCT0369
Contract: 11223344
Pool ID: 2c918f824e5ef0e8014e675ed2e30e8c
Provides Management: Yes
Available: 5
Suggested: 1
Service Level: Premium
Service Type: L1-L3
Subscription Type: Standard
Ends: 10/08/2015
System Type: Physical
And let's attach that sub. And there are two ways to do that.
# subscription-manager list --available \
--matches 'Red Hat Satellite Capsule Server' \
--pool-only | subscription-manager attach --file=-
Successfully attached a subscription for: Red Hat Satellite Capsule Server
OR
# subscription-manager attach \
--pool=$(subscription-manager list --available \
--matches 'Red Hat Satellite Capsule Server' --pool-only)
References
執筆者紹介
チャンネル別に見る
自動化
テクノロジー、チームおよび環境に関する IT 自動化の最新情報
AI (人工知能)
お客様が AI ワークロードをどこでも自由に実行することを可能にするプラットフォームについてのアップデート
オープン・ハイブリッドクラウド
ハイブリッドクラウドで柔軟に未来を築く方法をご確認ください。
セキュリティ
環境やテクノロジー全体に及ぶリスクを軽減する方法に関する最新情報
エッジコンピューティング
エッジでの運用を単純化するプラットフォームのアップデート
インフラストラクチャ
世界有数のエンタープライズ向け Linux プラットフォームの最新情報
アプリケーション
アプリケーションの最も困難な課題に対する Red Hat ソリューションの詳細
オリジナル番組
エンタープライズ向けテクノロジーのメーカーやリーダーによるストーリー
製品
ツール
試用、購入、販売
コミュニケーション
Red Hat について
エンタープライズ・オープンソース・ソリューションのプロバイダーとして世界をリードする Red Hat は、Linux、クラウド、コンテナ、Kubernetes などのテクノロジーを提供しています。Red Hat は強化されたソリューションを提供し、コアデータセンターからネットワークエッジまで、企業が複数のプラットフォームおよび環境間で容易に運用できるようにしています。
言語を選択してください
Red Hat legal and privacy links
- Red Hat について
- 採用情報
- イベント
- 各国のオフィス
- Red Hat へのお問い合わせ
- Red Hat ブログ
- ダイバーシティ、エクイティ、およびインクルージョン
- Cool Stuff Store
- Red Hat Summit