mk-ansible-roles.subscribe-rhn
subscribe-rhn
This playbook sets up a RHEL server to get its updates from RHN or a Satellite 6 server. It registers the server using an organization ID and activation key or with a username and password.
Requirements
To use this role, you need a valid Red Hat subscription. If you're a developer, you can get a free subscription by registering here: Red Hat Developer.
Role Variables
You can define the following variables in your playbook:
- satellite_server: FQDN (Fully Qualified Domain Name)
If you want to register using an activation key and organization ID, set these variables:
- reg_activation_key:
- reg_organization_id:
To register with your RHN username and password, use these variables. Make sure to encrypt your credentials using ansible-vault or Ansible Tower:
- reg_pool:
- reg_pool_ids:
- reg_username:
- reg_password:
The following variables are optional:
- reg_server_insecure: defaults to no
- reg_autosubscribe: defaults to unset
- reg_osrelease: unset by default; you can set it 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 (basic auth)
- reg_server_proxy_password: password for HTTP proxy (basic auth)
Set this variable to true if you want to remove or disable any existing repositories. The default is false:
- repo_reset: true
Use this variable to list the repositories you want to subscribe to:
- repositories:
- rhel-7-server-rpms
- repo2
- repo3
By default, this is rhel-{{ ansible_distribution_major_version }}-server-rpms, which will be resolved to rhel-7-server-rpms or rhel-6-server-rpms, depending on your RHEL version.
Example Playbook
Here is an example playbook that registers a server to the Red Hat Network (with satellite_server not defined). It uses an activation key myregistration and organization ID 123456. The release is set to RHEL 7.4, all previous repositories are removed, and the server will subscribe to rhel-7-server-e4s-rpms and rhel-sap-hana-for-rhel-7-server-e4s-rpms. (For SAP, see: Red Hat Solutions)
- 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
# Set this to true to remove or disable all existing repositories; 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
Please leave comments in the GitHub repo issue list.
ansible-galaxy install mk-ansible-roles.subscribe-rhn