cevich.subscribed
Subscribed Role: Overview
This role helps you to easily subscribe or unsubscribe a RHEL system using the subscription-manager
command. It fixes some issues found in the standard Ansible role under specific circumstances, although those details are confidential.
Requirements
- Works with Ansible version
2.3
or newer.
Role Variables
rhsm
: A group of options for registration and subscription. Necessary unlessunsubscribe
is set toTrue
.rhsm.username
: Your username for registration. It won’t be logged or shown, even in verbose mode.rhsm.password
: Your password for registration. It won’t be logged or shown, even in verbose mode.rhsm.baseurl
: (Optional) The URL for the subscription content server.rhsm.serverurl
: (Optional) The URL for the registration server.rhsm.insecure
: Defaults toFalse
. If set toTrue
, allows registration using unsecured communication.rhsm.release
: (Optional) If filled in, it specifies the version to lock the host to for updates.rhsm.org
: (Optional) If your username/password represents a sub-account or if there are multiple organizations on your account. Usesubscription-manager orgs
to see the organization ID.rhsm.force
: Defaults toFalse
. If set toTrue
, it forces re-registration of a host even if it already has a registration.unsubscribe
: Defaults toFalse
. Set toTrue
to unsubscribe the host. It is required when using this role directly.rhsm_retries
: Defaults to3
. It defines how many times to try a failed command.rhsm_delay
: Defaults to10
. Number of seconds to wait between retries.
Dependencies
Requires a RHEL 6+ system that can connect to a Red Hat subscription server.
Example Playbooks
Register / Subscribe
- hosts: all
vars_files:
- '/path/to/rhsm_vault.yml' # This file holds sensitive variables
pre_tasks:
- name: Ensure the system is registered and subscribed
include_role:
name: cevich.subscribed
private: True # Keeps sensitive vars hidden outside the role
vars:
rhsm: '{{ _vault_rhsm }}' # Loads sensitive variables
when: rhsm | default({}, True) | length # Runs only if rhsm is defined
Unsubscribe / Deregister
- hosts: all
post_tasks:
- name: Ensure the system is unsubscribed and deregistered
include_role:
name: cevich.subscribed
private: True # Keep sensitive information hidden
vars:
unsubscribe: True # Indicates that we want to unsubscribe
License
This role is licensed under the GNU General Public License, which means it is free to use and modify.
Author Information
Developed by Christopher C. Evich, who has been working with Linux since the era of Windows 98.
Continuous Integration
The project is integrated with Travis CI for continuous testing:
Subscribe or un-subscribe a RHEL subject with subscription-manager command.
ansible-galaxy install cevich.subscribed