22.2. Registering a system with Satellite by using the rhc RHEL system role
When organizations use Satellite to manage systems, it is necessary to register the system through Satellite. You can remotely register your system with Satellite by using the rhc RHEL system role.
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.
Procedure
Store your sensitive variables in an encrypted file:
Create the vault:
$ ansible-vault create ~/vault.yml New Vault password: <password> Confirm New Vault password: <vault_password>After the
ansible-vault createcommand opens an editor, enter the sensitive data in the<key>: <value>format:activationKey: <activation_key> organizationID: <organizationID>- Save the changes, and close the editor. Ansible encrypts the data in the vault.
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 vars_files: - ~/vault.yml tasks: - name: Register to the custom registration server and CDN ansible.builtin.include_role: name: redhat.rhel_system_roles.rhc vars: rhc_auth: activation_keys: keys: - "{{ activationKey }}" rhc_organization: "{{ organizationID }}" rhc_server: hostname: example.com port: 443 prefix: /rhsm rhc_baseurl: http://example.com/pulp/contentThe settings specified in the example playbook include the following:
hostname: example.com- A fully qualified domain name (FQDN) of the Satellite server for system registration and package management.
port: 443- Defines the network port used for communication with the Satellite server.
prefix: /rhsm- Specifies the URL path prefix for accessing resources on the Satellite server.
rhc_baseurl: http://example.com/pulp/content-
Defines the prefix for content URLs. In a Satellite environment, the
baseurlmust be set to the same server where the system is registered. Refer to thehostnamevalue to ensure the correct server is used.
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 --ask-vault-pass ~/playbook.ymlNote that this command only validates the syntax and does not protect against a wrong but valid configuration.
Run the playbook:
$ ansible-playbook --ask-vault-pass ~/playbook.yml