AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

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

code with ❤️ in GitHub

Conclusion

Now you know how to register a system with Red Hat Subscription-Manager with Ansible.

Related ArticlesAnsible Become GuideAnsible Inventory GuideAnsible Roles Guide

Category: installation

Watch the video: Ansible subscription-manager: Register RHEL with redhat_subscription Module — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home