22.10. Unregistering a system by using the rhc RHEL system role
You can use the rhc RHEL system role to unregister the system from the Red Hat subscription service if you no longer want to receive content from the registration server on a specific system, for example, system decommissioning, VM deletion, or when switching to a local content mirror.
Prerequisites
- You have prepared the control node and the managed nodes.
- You are logged in to the control node as a user who can run playbooks on the managed nodes.
-
The account you use to connect to the managed nodes has
sudopermissions for these nodes. - The system is already registered.
Procedure
Create a playbook file, for example,
~/playbook.yml, with the following content:--- - name: Managing systems with the rhc RHEL system role hosts: managed-node-01.example.com tasks: - name: Unregister the system ansible.builtin.include_role: name: redhat.rhel_system_roles.rhc vars: rhc_state: absentThe settings specified in the example playbook include the following:
rhc_state: absentSpecifies the system should be unregistered from the registration server, RHSM, or Satellite.
For details about all variables used in the playbook, see the
/usr/share/ansible/roles/rhel-system-roles.rhc/README.mdfile on the control node.
Validate the playbook syntax:
$ ansible-playbook --syntax-check ~/playbook.ymlNote that this command only validates the syntax and does not protect against a wrong but valid configuration.
Run the playbook:
$ ansible-playbook ~/playbook.yml