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
Sobre el autor
Navegar por canal
Automatización
Las últimas novedades en la automatización de la TI para los equipos, la tecnología y los entornos
Inteligencia artificial
Descubra las actualizaciones en las plataformas que permiten a los clientes ejecutar cargas de trabajo de inteligecia artificial en cualquier lugar
Nube híbrida abierta
Vea como construimos un futuro flexible con la nube híbrida
Seguridad
Vea las últimas novedades sobre cómo reducimos los riesgos en entornos y tecnologías
Edge computing
Conozca las actualizaciones en las plataformas que simplifican las operaciones en el edge
Infraestructura
Vea las últimas novedades sobre la plataforma Linux empresarial líder en el mundo
Aplicaciones
Conozca nuestras soluciones para abordar los desafíos más complejos de las aplicaciones
Programas originales
Vea historias divertidas de creadores y líderes en tecnología empresarial
Productos
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Servicios de nube
- Ver todos los productos
Herramientas
- Training y Certificación
- Mi cuenta
- Soporte al cliente
- Recursos para desarrolladores
- Busque un partner
- Red Hat Ecosystem Catalog
- Calculador de valor Red Hat
- Documentación
Realice pruebas, compras y ventas
Comunicarse
- Comuníquese con la oficina de ventas
- Comuníquese con el servicio al cliente
- Comuníquese con Red Hat Training
- Redes sociales
Acerca de Red Hat
Somos el proveedor líder a nivel mundial de soluciones empresariales de código abierto, incluyendo Linux, cloud, contenedores y Kubernetes. Ofrecemos soluciones reforzadas, las cuales permiten que las empresas trabajen en distintas plataformas y entornos con facilidad, desde el centro de datos principal hasta el extremo de la red.
Seleccionar idioma
Red Hat legal and privacy links
- Acerca de Red Hat
- Oportunidades de empleo
- Eventos
- Sedes
- Póngase en contacto con Red Hat
- Blog de Red Hat
- Diversidad, igualdad e inclusión
- Cool Stuff Store
- Red Hat Summit