mk-ansible-roles.subscribe_rhn
Subscribe RHN Playbook
This playbook sets up a RHEL server to get updates from RHN or a Satellite 6 server. It registers the server with the Satellite or RHN using an organization ID and activation key, or with a username and password.
Requirements
To use this playbook, you need a valid Red Hat subscription. If you are a developer, you can get a personal free subscription by signing up at Red Hat Developer.
Role Variables
You can set the following variables in the playbook:
- satellite_server: Fully Qualified Domain Name (FQDN)
To register with an activation key and organization ID, set:
- reg_activation_key:
- reg_organization_id:
To register using your RHN username and password, use the following variables. It’s advised to encrypt your credentials using ansible-vault or Tower:
- reg_pool:
- reg_pool_ids:
- reg_username:
- reg_password:
The following are optional settings:
- reg_server_insecure: defaults to no
- reg_autosubscribe: defaults to unset
- reg_osrelease: default unset, can be set to versions like 7Server, 7.2, 7.3, etc.
- reg_server_proxy_hostname: HTTP proxy hostname
- reg_server_proxy_port: HTTP proxy port
- reg_server_proxy_user: user for HTTP proxy with basic authentication
- reg_server_proxy_password: password for HTTP proxy with basic authentication
Repository Management
Set this variable to true if you wish to remove all previously existing repositories. The default value is false:
- repo_reset: true
Use this to specify the repositories you want to subscribe to:
repositories:
- rhel-7-server-rpms
- repo2
- repo3
The default is rhel-{{ ansible_distribution_major_version }}-server-rpms
, which resolves to either rhel-7-server-rpms
or rhel-6-server-rpms
, depending on your RHEL major version.
Example Playbook
Here’s an example playbook that registers a server with Red Hat Network (satellite_server is not defined) using the activation key myregistration
and organization ID 123456
. The system is set to RHEL 7.4, all previous repositories are removed, and it will subscribe to rhel-7-server-e4s-rpms
and rhel-sap-hana-for-rhel-7-server-e4s-rpms
. (For SAP, refer to Red Hat Support)
- hosts: servers
remote_user: root
vars:
# satellite_server: FQDN
#
# Option 1
reg_activation_key: myregistration
reg_organization_id: 123456
#
# Option 2:
# reg_pool:
# reg_pool_ids:
# reg_username:
# reg_password:
#
# Optional settings
reg_server_insecure: yes
#reg_autosubscribe: yes
reg_osrelease: 7.4
# Remove all previously existing repositories if set to true. Default is false.
repo_reset: true
repositories:
- rhel-7-server-e4s-rpms
- rhel-sap-hana-for-rhel-7-server-e4s-rpms
roles:
- { role: mk-ansible-roles.subscribe-rhn }
License
Apache License, Version 2.0, January 2004
Author Information
Markus Koch
Feel free to leave comments in the GitHub repository issue list.
ansible-galaxy install mk-ansible-roles.subscribe_rhn