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 — Video Tutorial

How to register RHEL systems with Red Hat Subscription-Manager using Ansible. Automate registration, pool assignment, and package installation with examples.

Watch Video

Watch "Ansible subscription-manager: Register RHEL with redhat_subscription Module" on YouTube

What You'll Learn

Full Tutorial Content

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 ```yaml --- - name: subscription-manager module Playbook hosts: all become: true vars: subscription_username: "username" subscription_password: "password" tasks: - name: register with subscription-manager community.general.redhat_subscription: state: present username: "{{ subscription_username }}" password: "{{ subscription_password }}" auto_attach: true ``` execution ```bash $ ansible-playbook -i virtualmachines/demo/inventory register\ RedHat\ subscription/subscription_manager.yml PLAY [subscription-manager module Playbook] *********************************************************** TASK [Gathering Facts] **************************************************************************** ok: [demo.example.com] TASK [register with subscription-manager] ********************************************************* changed: [demo.example.com] PLAY RECAP **************************************************************************************** dem

About This Tutorial

Read the full written article: Ansible subscription-manager: Register RHEL with redhat_subscription Module

Topics Covered

Related Video Tutorials