Este conteúdo não está disponível no idioma selecionado.
Chapter 7. Using the rhc System Role to register the system
The rhc RHEL System Role enables administrators to automate the registration of multiple systems with Red Hat Subscription Management (RHSM) and Satellite servers. The role also supports Insights-related configuration and management tasks by using Ansible.
7.1. Introduction to the rhc System Role Copiar o linkLink copiado para a área de transferência!
RHEL System Role is a set of roles that provides a consistent configuration interface to remotely manage multiple systems. The remote host configuration (rhc) System Role enables administrators to easily register RHEL systems to Red Hat Subscription Management (RHSM) and Satellite servers. By default, when you register a system by using the rhc System Role, the system is connected to Insights. Additionally, with the rhc System Role, you can:
- Configure connections to Red Hat Insights
- Enable and disable repositories
- Configure the proxy to use for the connection
- Configure insights remediations and, auto updates
- Set the release of the system
- Configure insights tags
7.2. Registering a system by using the rhc System Role Copiar o linkLink copiado para a área de transferência!
You can register your system to Red Hat by using the rhc RHEL System Role. By default, the rhc RHEL System Role connects the system to Red Hat Insights when you register it.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
Procedure
Create a vault to save the sensitive information:
ansible-vault create secrets.yml
$ ansible-vault create secrets.yml New Vault password: password Confirm New Vault password: passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
ansible-vault createcommand creates an encrypted vault file and opens it in an editor. Enter the sensitive data you want to save in the vault, for example:activationKey: activation_key username: username password: password
activationKey: activation_key username: username password: passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow Save the changes, and close the editor. Ansible encrypts the data in the vault.
You can later edit the data in the vault by using the
ansible-vault edit secrets.ymlcommand.Optional: Display the vault content:
ansible-vault view secrets.yml
$ ansible-vault view secrets.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a playbook file, for example
~/registration.yml, and use one of the following options depending on the action you want to perform:To register by using an activation key and organization ID (recommended), use the following playbook:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To register by using a username and password, use the following playbook:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Run the playbook:
ansible-playbook ~/registration.yml --ask-vault-pass
# ansible-playbook ~/registration.yml --ask-vault-passCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.3. Registering a system with Satellite by using the rhc System Role Copiar o linkLink copiado para a área de transferência!
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 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
Procedure
Create a vault to save the sensitive information:
ansible-vault create secrets.yml
$ ansible-vault create secrets.yml New Vault password: password Confirm New Vault password: passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
ansible-vault createcommand creates an encrypted file and opens it in an editor. Enter the sensitive data you want to save in the vault, for example:activationKey: activation_key
activationKey: activation_keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Save the changes, and close the editor. Ansible encrypts the data in the vault.
You can later edit the data in the vault by using the
ansible-vault edit secrets.ymlcommand.Optional: Display the vault content:
ansible-vault view secrets.yml
$ ansible-vault view secrets.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Create a playbook file, for example
~/registration-sat.yml. Use the following text in
~/registration-sat.ymlto register the system by using an activation key and organization ID:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook:
ansible-playbook ~/registration-sat.yml --ask-vault-pass
# ansible-playbook ~/registration-sat.yml --ask-vault-passCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.4. Disabling the connection to Insights after the registration by using the rhc System Role Copiar o linkLink copiado para a área de transferência!
When you register a system by using the rhc RHEL System Role, the role by default, enables the connection to Red Hat Insights. You can disable it by using the rhc System Role, if not required.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
- The system is already registered.
Procedure
Create a playbook file, for example
~/dis-insights.ymland add the following content in it:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook:
ansible-playbook ~/dis-insights.yml
# ansible-playbook ~/dis-insights.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.5. Enabling repositories by using the rhc System Role Copiar o linkLink copiado para a área de transferência!
You can remotely enable or disable repositories on managed nodes by using the rhc RHEL System Role.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
- You have details of the repositories which you want to enable or disable on the managed nodes.
- You have registered the system.
Procedure
Create a playbook file, for example
~/configure-repos.yml:To enable a repository:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To disable a repository:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Run the playbook:
ansible-playbook ~/configure-repos.yml
# ansible-playbook ~/configure-repos.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.6. Setting release versions by using the rhc system role Copiar o linkLink copiado para a área de transferência!
You can limit the system to use only repositories for a particular minor RHEL version instead of the latest one. This way, you can lock your system to a specific minor RHEL version.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
- You know the minor RHEL version to which you want to lock the system. Note that you can only lock the system to the RHEL minor version that the host currently runs or a later minor version.
- You have registered the system.
Procedure
Create a playbook file, for example
~/release.yml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook:
ansible-playbook ~/release.yml
# ansible-playbook ~/release.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.7. Using a proxy server when registering the host by using the rhc System Role Copiar o linkLink copiado para a área de transferência!
If your security restrictions allow access to the Internet only through a proxy server, you can specify the proxy’s settings in the playbook when you register the system using the rhc RHEL System Role.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
Procedure
Create a vault to save the sensitive information:
ansible-vault create secrets.yml
$ ansible-vault create secrets.yml New Vault password: password Confirm New Vault password: passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
ansible-vault createcommand creates an encrypted file and opens it in an editor. Enter the sensitive data you want to save in the vault, for example:username: username password: password proxy_username: proxyusernme proxy_password: proxypassword
username: username password: password proxy_username: proxyusernme proxy_password: proxypasswordCopy to Clipboard Copied! Toggle word wrap Toggle overflow Save the changes, and close the editor. Ansible encrypts the data in the vault.
You can later edit the data in the vault by using the
ansible-vault edit secrets.ymlcommand.Optional: Display the vault content:
ansible-vault view secrets.yml
$ ansible-vault view secrets.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a playbook file, for example
~/configure-proxy.yml:To register to the RHEL customer portal by using a proxy:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To remove the proxy server from the configuration of the Red Hat Subscription Manager service:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Run the playbook:
ansible-playbook ~/configure-proxy.yml --ask-vault-pass
# ansible-playbook ~/configure-proxy.yml --ask-vault-passCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.8. Disabling auto updates of Insights rules by using the rhc System Role Copiar o linkLink copiado para a área de transferência!
You can disable the automatic collection rule updates for Red Hat Insights by using the rhc RHEL System Role. By default, when you connect your system to Red Hat Insights, this option is enabled. You can disable it by using the rhc RHEL System Role.
If you disable this feature, you risk using outdated rule definition files and not getting the most recent validation updates.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
- You have registered the system.
Procedure
Create a vault to save the sensitive information:
ansible-vault create secrets.yml
$ ansible-vault create secrets.yml New Vault password: password Confirm New Vault password: passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
ansible-vault createcommand creates an encrypted file and opens it in an editor. Enter the sensitive data you want to save in the vault, for example:username: username password: password
username: username password: passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow Save the changes, and close the editor. Ansible encrypts the data in the vault.
You can later edit the data in the vault by using the
ansible-vault edit secrets.ymlcommand.Optional: Display the vault content:
ansible-vault view secrets.yml
$ ansible-vault view secrets.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a playbook file, for example
~/auto-update.ymland add following content to it:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook:
ansible-playbook ~/auto-update.yml --ask-vault-pass
# ansible-playbook ~/auto-update.yml --ask-vault-passCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.9. Disabling Insights remediations by using the rhc RHEL System Role Copiar o linkLink copiado para a área de transferência!
You can configure systems to automatically update the dynamic configuration by using the rhc RHEL System Role. When you connect your system to Red hat Insights, it is enabled by default. You can disable it, if not required.
Enabling remediation with the rhc System Role ensures your system is ready to be remediated when connected directly to Red Hat. For systems connected to a Satellite, or Capsule, enabling remediation must be achieved differently. For more information about Red Hat Insights remediations, see Red Hat Insights Remediations Guide.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
- You have Insights remediations enabled.
- You have registered the system.
Procedure
To enable the remediation, create a playbook file, for example
~/remediation.yml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook:
ansible-playbook ~/remediation.yml
# ansible-playbook ~/remediation.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.10. Configuring Insights tags by using the rhc system role Copiar o linkLink copiado para a área de transferência!
You can use tags for system filtering and grouping. You can also customize tags based on the requirements.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
Procedure
Create a vault to save the sensitive information:
ansible-vault create secrets.yml
$ ansible-vault create secrets.yml New Vault password: password Confirm New Vault password: passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
ansible-vault createcommand creates an encrypted file and opens it in an editor. Enter the sensitive data you want to save in the vault, for example:username: username password: password
username: username password: passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow Save the changes, and close the editor. Ansible encrypts the data in the vault.
You can later edit the data in the vault by using the
ansible-vault edit secrets.ymlcommand.Optional: Display the vault content:
ansible-vault view secrets.yml
$ ansible-vault view secrets.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a playbook file, for example
~/tags.yml, and add following content to it:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook:
ansible-playbook ~/remediation.yml --ask-vault-pass
# ansible-playbook ~/remediation.yml --ask-vault-passCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.11. Unregistering a system by using the RHC System Role Copiar o linkLink copiado para a área de transferência!
You can unregister the system from Red Hat if you no longer need the subscription service.
Prerequisites
- 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 on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
- The system is already registered.
Procedure
To unregister, create a playbook file, for example,
~/unregister.ymland add the following content to it:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook:
ansible-playbook ~/unregister.yml
# ansible-playbook ~/unregister.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow