Ansible subscription-manager: Register RHEL with redhat_subscription Module
By Luca Berton · Published 2024-01-01 · Category: installation
How to register RHEL systems with Red Hat Subscription-Manager using Ansible. Automate registration, pool assignment, and package installation with examples.
How to register a system with Red Hat Subscription-Manager with Ansible? I'm going to show you a live Playbook and some simple Ansible code. I'm Luca Berton and welcome to today's episode of Ansible Pilot.
Ansible register a system with Red Hat Subscription-Manager • community.general.redhat_subscription • Manage registration and subscriptions to RHSM using the subscription-manager command
Today we're talking about the Ansible module redhat_subscription. The full name is community.general.redhat_subscription, which means that is part of the collection community.general maintained by the Ansible community Manage registration and subscriptions to RHSM using the subscription-manager command. This module is specific for RedHat Enterprise Linux.
Parameters • state _string_ - present/absent • username _string_ - access.redhat.com or Satellite 6 username • password _string_ - access.redhat.com or Satellite 6 password • auto_attach _boolean_ - no/yes auto-consume available subscriptions • pool_id _list_ - subscription pool IDs to consume • pool _string_ - '^(Red Hat Enterprise Server|Red Hat Virtualization)$' • consumer_id _string_ - resume a previous registration
Let me summarize the main parameters. The state parameter allows you to specify if you want to add or remove a registration from the target machine. The username and password allow you to specify the access.redhat.com website credential or Satellite 6 credential. Once the machine is registered you need to define which subscription to consume. The auto_attach allows you to auto consume all the available subscriptions for the Machine. Alternatively you can specify manually the ID in the pool_id list or a text with all the products that you want to add. Another interesting option is the parameter customer_id to resume a previous registration.
## Playbook
Live Playbook of how to register a system with Red Hat Subscription-Manager with Ansible playbook
code • subscription-manager.yml
execution
before execution
after execution
Conclusion
Now you know how to register a system with Red Hat Subscription-Manager with Ansible.
Related Articles • Ansible Become Guide • Ansible Inventory Guide • Ansible Roles Guide
Category: installation
Watch the video: Ansible subscription-manager: Register RHEL with redhat_subscription Module — Video Tutorial