此内容没有您所选择的语言版本。
Chapter 5. Ansible-based overcloud registration
The director uses Ansible-based methods to register overcloud nodes to the Red Hat Customer Portal or a Red Hat Satellite 6 server.
The rhsm composable service provides a method to register overcloud nodes through Ansible. Each role in the default roles_data file contains a OS::TripleO::Services::Rhsm resource, which is disabled by default. To enable the service, register the resource to the rhsm composable service file:
resource_registry: OS::TripleO::Services::Rhsm: /usr/share/openstack-tripleo-heat-templates/deployment/rhsm/rhsm-baremetal-ansible.yaml
resource_registry:
OS::TripleO::Services::Rhsm: /usr/share/openstack-tripleo-heat-templates/deployment/rhsm/rhsm-baremetal-ansible.yaml
The rhsm composable service accepts a RhsmVars parameter, which allows you to define multiple sub-parameters relevant to your registration. For example:
You can also use the RhsmVars parameter in combination with role-specific parameters (e.g. ControllerParameters) to provide flexibility when enabling specific repositories for different nodes types.
The next section is a list of sub-parameters available to use with the RhsmVars parameter for use with the rhsm composable service.
5.2. RhsmVars sub-parameters 复制链接链接已复制到粘贴板!
See the role documentation to learn about all Ansible parameters.
rhsm | Description |
|---|---|
|
|
Choose the registration method. Either |
|
|
The organization to use for registration. To locate this ID, run |
|
|
The subscription pool ID to use. Use this if not auto-attaching subscriptions. To locate this ID, run |
|
|
The activation key to use for registration. Does not work when |
|
|
Automatically attach compatible subscriptions to this system. Set to |
|
| The base URL for obtaining content. The default is the Red Hat Content Delivery Network URL. If using a Satellite server, change this value to the base URL of your Satellite server content repositories. |
|
| The hostname of the subscription management service for registration. The default is the Red Hat Subscription Management hostname. If using a Satellite server, change this value to your Satellite server hostname. |
|
|
A list of repositories to enable. Does not work when |
|
| The username for registration. If possible, use activation keys for registration. |
|
| The password for registration. If possible, use activation keys for registration. |
|
|
The hostname for the HTTP proxy. For example: |
|
|
The port for HTTP proxy communication. For example: |
|
| The username to access the HTTP proxy. |
|
| The password to access the HTTP proxy. |
Now that you have an understanding of how the rhsm composable service works and how to configure it, you can use the following procedures to configure your own registration details.
Use the following procedure to create an environment file that enables and configures the rhsm composable service. The director uses this environment file to register and subscribe your nodes.
Procedure
-
Create an environment file (
templates/rhsm.yml) to store the configuration. Include your configuration in the environment file. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
resource_registryassociates therhsmcomposable service with theOS::TripleO::Services::Rhsmresource, which is available on each role.The
RhsmVarsvariable passes parameters to Ansible for configuring your Red Hat registration.- Save the environment file.
You can also provide registration details to specific overcloud roles. The next section provides an example of this.
You can apply the rhsm composable service on a per-role basis. For example, you can apply different sets of configurations to Controller nodes, Compute nodes, and Ceph Storage nodes.
Procedure
-
Create an environment file (
templates/rhsm.yml) to store the configuration. Include your configuration in the environment file. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
resource_registryassociates therhsmcomposable service with theOS::TripleO::Services::Rhsmresource, which is available on each role.The
ControllerParameters,ComputeParameters, andCephStorageParametersuse their ownRhsmVarsparameter to pass subscription details to their respective roles.NoteSet the
RhsmVarsparameter within theCephStorageParametersparameter to use a Red Hat Ceph Storage subscription and repositories specific to Ceph Storage. Ensure therhsm_reposparameter contains the standard Red Hat Enterprise Linux repositories instead of the Extended Update Support (EUS) repositories that Controller and Compute nodes require.- Save the environment file.
5.5. Registering the overcloud to Red Hat Satellite 复制链接链接已复制到粘贴板!
Use the following procedure to create an environment file that enables and configures the rhsm composable service to register nodes to Red Hat Satellite instead of the Red Hat Customer Portal.
Procedure
-
Create an environment file (
templates/rhsm.yml) to store the configuration. Include your configuration in the environment file. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
resource_registryassociates therhsmcomposable service with theOS::TripleO::Services::Rhsmresource, which is available on each role.The
RhsmVarsvariable passes parameters to Ansible for configuring your Red Hat registration.- Save the environment file.
These procedures enable and configure rhsm on the overcloud. However, if you used the rhel-registration method from previous Red Hat OpenStack Platform version, you must disable it and switch to the Ansible-based method. Use the following procedure to switch from the old rhel-registration method to the Ansible-based method.
5.6. Switching to the rhsm composable service 复制链接链接已复制到粘贴板!
The previous rhel-registration method runs a bash script to handle the overcloud registration. The scripts and environment files for this method are located in the core Heat template collection at /usr/share/openstack-tripleo-heat-templates/extraconfig/pre_deploy/rhel-registration/.
Complete the following steps to switch from the rhel-registration method to the rhsm composable service.
Procedure
Exclude the
rhel-registrationenvironment files from future deployments operations. In most cases, exclude the following files:-
rhel-registration/environment-rhel-registration.yaml -
rhel-registration/rhel-registration-resource-registry.yaml
-
If you use a custom
roles_datafile, ensure that each role in yourroles_datafile contains theOS::TripleO::Services::Rhsmcomposable service. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Add the environment file for
rhsmcomposable service parameters to future deployment operations.
This method replaces the rhel-registration parameters with the rhsm service parameters and changes the Heat resource that enables the service from:
resource_registry: OS::TripleO::NodeExtraConfig: rhel-registration.yaml
resource_registry:
OS::TripleO::NodeExtraConfig: rhel-registration.yaml
To:
resource_registry: OS::TripleO::Services::Rhsm: /usr/share/openstack-tripleo-heat-templates/deployment/rhsm/rhsm-baremetal-ansible.yaml
resource_registry:
OS::TripleO::Services::Rhsm: /usr/share/openstack-tripleo-heat-templates/deployment/rhsm/rhsm-baremetal-ansible.yaml
You can also include the /usr/share/openstack-tripleo-heat-templates/environments/rhsm.yaml environment file with your deployment to enable the service.
To help transition your details from the rhel-registration method to the rhsm method, use the following table to map the your parameters and their values.
5.7. rhel-registration to rhsm mappings 复制链接链接已复制到粘贴板!
rhel-registration | rhsm / RhsmVars |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Now that you have configured the environment file for the rhsm service, you can include it with your next overcloud deployment operation.
This section shows how to apply your rhsm configuration to the overcloud.
Procedure
Include
rhsm.ymlenvironment file with theopenstack overcloud deploy:openstack overcloud deploy \ <other cli args> \ -e ~/templates/rhsm.yamlopenstack overcloud deploy \ <other cli args> \ -e ~/templates/rhsm.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow This enables the Ansible configuration of the overcloud and the Ansible-based registration.
- Wait until the overcloud deployment completes.
Check the subscription details on your overcloud nodes. For example, log into a Controller node and run the following commands:
sudo subscription-manager status sudo subscription-manager list --consumed
$ sudo subscription-manager status $ sudo subscription-manager list --consumedCopy to Clipboard Copied! Toggle word wrap Toggle overflow
In addition to the director-based registration method, you can also manually register after deployment.
5.9. Running Ansible-based registration manually 复制链接链接已复制到粘贴板!
You can perform manual Ansible-based registration on a deployed overcloud. You accomplish this using the director’s dynamic inventory script to define node roles as host groups and then run a playbook against them using ansible-playbook. The following example shows how to manually register Controller nodes using a playbook.
Procedure
Create a playbook with that using the
redhat_subscriptionmodules to register your nodes. For example, the following playbook applies to Controller nodes:Copy to Clipboard Copied! Toggle word wrap Toggle overflow This play contains three tasks:
- Register the node using an activation key.
- Disable any auto-enabled repositories.
-
Enable only the repositories relevant to the Controller node. The repositories are listed with the
reposvariable.
After deploying the overcloud, you can run the following command so that Ansible executes the playbook (
ansible-osp-registration.yml) against your overcloud:ansible-playbook -i /usr/bin/tripleo-ansible-inventory ansible-osp-registration.yml
$ ansible-playbook -i /usr/bin/tripleo-ansible-inventory ansible-osp-registration.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command does the following:
- Runs the dynamic inventory script to get a list of host and their groups.
-
Applies the playbook tasks to the nodes in the group defined in the playbook’s
hostsparameter, which in this case is the Controller group.
Red Hat OpenStack Platform 16.0 is supported on Red Hat Enterprise Linux 8.1. After deploying your overcloud, lock the overcloud repositories to the Red Hat Enterprise Linux 8.1 release.
Prerequisites
- You have deployed an overcloud with all nodes registered with the Red Hat Subscription Manager (RHSM) composable service.
Procedure
-
Log into the undercloud as the
stackuser. Source the
stackrcfile:source ~/stackrc
$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a static inventory file of your overcloud:
tripleo-ansible-inventory --ansible_ssh_user heat-admin --static-yaml-inventory ~/inventory.yaml
$ tripleo-ansible-inventory --ansible_ssh_user heat-admin --static-yaml-inventory ~/inventory.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you use an overcloud name different to the default overcloud name of
overcloud, set the name of your overcloud with the--planoption.Create a playbook that contains a task to lock the operating system version to Red Hat Enterprise Linux 8.1 on all nodes:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
set_release.yamlplaybook:ansible-playbook -i ~/inventory.yaml -f 25 ~/set_release.yaml
$ ansible-playbook -i ~/inventory.yaml -f 25 ~/set_release.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
To manually lock a node to a version, log in to the node and run the subscription-manager release command:
sudo subscription-manager release --set=8.1
$ sudo subscription-manager release --set=8.1