Questo contenuto non è disponibile nella lingua selezionata.
Chapter 10. Configuring the overcloud with the Orchestration service (heat)
You can use the Orchestration service (heat) to create custom overcloud configurations in heat templates and environment files.
10.1. Understanding heat templates Copia collegamentoCollegamento copiato negli appunti!
The custom configurations in this guide use heat templates and environment files to define certain aspects of the overcloud. This chapter provides a basic introduction to heat templates so that you can understand the structure and format of these templates in the context of Red Hat OpenStack Platform director.
10.1.1. heat templates Copia collegamentoCollegamento copiato negli appunti!
Director uses Heat Orchestration Templates (HOT) as the template format for the overcloud deployment plan. Templates in HOT format are usually expressed in YAML format. The purpose of a template is to define and create a stack, which is a collection of resources that OpenStack Orchestration (heat) creates, and the configuration of the resources. Resources are objects in Red Hat OpenStack Platform (RHOSP) and can include compute resources, network configuration, security groups, scaling rules, and custom resources.
A heat template has three main sections:
- parameters
-
These are settings passed to heat, which provide a way to customize a stack, and any default values for parameters without passed values. These settings are defined in the
parameterssection of a template. - resources
-
Use the
resourcessection to define the resources, such as compute instances, networks, and storage volumes, that you can create when you deploy a stack using this template. Red Hat OpenStack Platform (RHOSP) contains a set of core resources that span across all components. These are the specific objects to create and configure as part of a stack. RHOSP contains a set of core resources that span across all components. These are defined in theresourcessection of a template. - outputs
-
Use the
outputssection to declare the output parameters that your cloud users can access after the stack is created. Your cloud users can use these parameters to request details about the stack, such as the IP addresses of deployed instances, or URLs of web applications deployed as part of the stack.
Example of a basic heat template:
This template uses the resource type type: OS::Nova::Server to create an instance called my_instance with a particular flavor, image, and key that the cloud user specifies. The stack can return the value of instance_name, which is called My Cirros Instance.
When heat processes a template, it creates a stack for the template and a set of child stacks for resource templates. This creates a hierarchy of stacks that descend from the main stack that you define with your template. You can view the stack hierarchy with the following command:
openstack stack list --nested
$ openstack stack list --nested
10.1.2. Environment files Copia collegamentoCollegamento copiato negli appunti!
An environment file is a special type of template that you can use to customize your heat templates. You can include environment files in the deployment command, in addition to the core heat templates. An environment file contains three main sections:
- resource_registry
- This section defines custom resource names, linked to other heat templates. This provides a method to create custom resources that do not exist within the core resource collection.
- parameters
- These are common settings that you apply to the parameters of the top-level template. For example, if you have a template that deploys nested stacks, such as resource registry mappings, the parameters apply only to the top-level template and not to templates for the nested resources.
- parameter_defaults
- These parameters modify the default values for parameters in all templates. For example, if you have a heat template that deploys nested stacks, such as resource registry mappings,the parameter defaults apply to all templates.
Use parameter_defaults instead of parameters when you create custom environment files for your overcloud, so that your parameters apply to all stack templates for the overcloud.
Example of a basic environment file:
This environment file (my_env.yaml) might be included when creating a stack from a certain heat template (my_template.yaml). The my_env.yaml file creates a new resource type called OS::Nova::Server::MyServer. The myserver.yaml file is a heat template file that provides an implementation for this resource type that overrides any built-in ones. You can include the OS::Nova::Server::MyServer resource in your my_template.yaml file.
MyIP applies a parameter only to the main heat template that deploys with this environment file. In this example, MyIP applies only to the parameters in my_template.yaml.
NetworkName applies to both the main heat template, my_template.yaml, and the templates that are associated with the resources that are included in the main template, such as the OS::Nova::Server::MyServer resource and its myserver.yaml template in this example.
For RHOSP to use the heat template file as a custom template resource, the file extension must be either .yaml or .template.
10.1.3. Core overcloud heat templates Copia collegamentoCollegamento copiato negli appunti!
Director contains a core heat template collection and environment file collection for the overcloud. This collection is stored in /usr/share/openstack-tripleo-heat-templates.
The main files and directories in this template collection are:
overcloud.j2.yaml- This is the main template file that director uses to create the overcloud environment. This file uses Jinja2 syntax to iterate over certain sections in the template to create custom roles. The Jinja2 formatting is rendered into YAML during the overcloud deployment process.
overcloud-resource-registry-puppet.j2.yaml- This is the main environment file that director uses to create the overcloud environment. It provides a set of configurations for Puppet modules stored on the overcloud image. After director writes the overcloud image to each node, heat starts the Puppet configuration for each node by using the resources registered in this environment file. This file uses Jinja2 syntax to iterate over certain sections in the template to create custom roles. The Jinja2 formatting is rendered into YAML during the overcloud deployment process.
roles_data.yaml- This file contains the definitions of the roles in an overcloud and maps services to each role.
network_data.yaml-
This file contains the definitions of the networks in an overcloud and their properties such as subnets, allocation pools, and VIP status. The default
network_data.yamlfile contains the default networks: External, Internal Api, Storage, Storage Management, Tenant, and Management. You can create a customnetwork_data.yamlfile and add it to youropenstack overcloud deploycommand with the-noption. plan-environment.yaml- This file contains the definitions of the metadata for your overcloud plan. This includes the plan name, main template to use, and environment files to apply to the overcloud.
capabilities-map.yaml- This file contains a mapping of environment files for an overcloud plan.
deployment-
This directory contains heat templates. The
overcloud-resource-registry-puppet.j2.yamlenvironment file uses the files in this directory to drive the application of the Puppet configuration on each node. environments-
This directory contains additional heat environment files that you can use for your overcloud creation. These environment files enable extra functions for your resulting Red Hat OpenStack Platform (RHOSP) environment. For example, the directory contains an environment file to enable Cinder NetApp backend storage (
cinder-netapp-config.yaml). network- This directory contains a set of heat templates that you can use to create isolated networks and ports.
puppet-
This directory contains templates that control Puppet configuration. The
overcloud-resource-registry-puppet.j2.yamlenvironment file uses the files in this directory to drive the application of the Puppet configuration on each node. puppet/services-
This directory contains legacy heat templates for all service configuration. The templates in the
deploymentdirectory replace most of the templates in thepuppet/servicesdirectory. extraconfig- This directory contains templates that you can use to enable extra functionality.
10.1.4. Including environment files in overcloud creation Copia collegamentoCollegamento copiato negli appunti!
Include environment files in the deployment command with the -e option. You can include as many environment files as necessary. However, the order of the environment files is important as the parameters and resources that you define in subsequent environment files take precedence. For example, you have two environment files that contain a common resource type OS::TripleO::NodeExtraConfigPost, and a common parameter TimeZone:
environment-file-1.yaml
environment-file-2.yaml
resource_registry: OS::TripleO::NodeExtraConfigPost: /home/stack/templates/template-2.yaml parameter_defaults: TimeZone: 'Hongkong'
resource_registry:
OS::TripleO::NodeExtraConfigPost: /home/stack/templates/template-2.yaml
parameter_defaults:
TimeZone: 'Hongkong'
You include both environment files in the deployment command:
openstack overcloud deploy --templates -e environment-file-1.yaml -e environment-file-2.yaml
$ openstack overcloud deploy --templates -e environment-file-1.yaml -e environment-file-2.yaml
The openstack overcloud deploy command runs through the following process:
- Loads the default configuration from the core heat template collection.
-
Applies the configuration from
environment-file-1.yaml, which overrides any common settings from the default configuration. -
Applies the configuration from
environment-file-2.yaml, which overrides any common settings from the default configuration andenvironment-file-1.yaml.
This results in the following changes to the default configuration of the overcloud:
-
OS::TripleO::NodeExtraConfigPostresource is set to/home/stack/templates/template-2.yaml, as defined inenvironment-file-2.yaml. -
TimeZoneparameter is set toHongkong, as defined inenvironment-file-2.yaml. -
RabbitFDLimitparameter is set to65536, as defined inenvironment-file-1.yaml.environment-file-2.yamldoes not change this value.
You can use this mechanism to define custom configuration for your overcloud without values from multiple environment files conflicting.
10.1.5. Using customized core heat templates Copia collegamentoCollegamento copiato negli appunti!
When creating the overcloud, director uses a core set of heat templates located in /usr/share/openstack-tripleo-heat-templates. If you want to customize this core template collection, use the following Git workflows to manage your custom template collection:
Procedure
Create an initial Git repository that contains the heat template collection:
Copy the template collection to the
/home/stack/templatesdirectory:cd ~/templates cp -r /usr/share/openstack-tripleo-heat-templates .
$ cd ~/templates $ cp -r /usr/share/openstack-tripleo-heat-templates .Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change to the custom template directory and initialize a Git repository:
cd ~/templates/openstack-tripleo-heat-templates git init .
$ cd ~/templates/openstack-tripleo-heat-templates $ git init .Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure your Git user name and email address:
git config --global user.name "<USER_NAME>" git config --global user.email "<EMAIL_ADDRESS>"
$ git config --global user.name "<USER_NAME>" $ git config --global user.email "<EMAIL_ADDRESS>"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Replace
<USER_NAME>with the user name that you want to use. Replace
<EMAIL_ADDRESS>with your email address.Stage all templates for the initial commit:
git add *
$ git add *Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an initial commit:
git commit -m "Initial creation of custom core heat templates"
$ git commit -m "Initial creation of custom core heat templates"Copy to Clipboard Copied! Toggle word wrap Toggle overflow This creates an initial
masterbranch that contains the latest core template collection. Use this branch as the basis for your custom branch and merge new template versions to this branch.
Use a custom branch to store your changes to the core template collection. Use the following procedure to create a
my-customizationsbranch and add customizations:Create the
my-customizationsbranch and switch to it:git checkout -b my-customizations
$ git checkout -b my-customizationsCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the files in the custom branch.
Stage the changes in git:
git add [edited files]
$ git add [edited files]Copy to Clipboard Copied! Toggle word wrap Toggle overflow Commit the changes to the custom branch:
git commit -m "[Commit message for custom changes]"
$ git commit -m "[Commit message for custom changes]"Copy to Clipboard Copied! Toggle word wrap Toggle overflow This adds your changes as commits to the
my-customizationsbranch. When themasterbranch updates, you can rebasemy-customizationsoffmaster, which causes git to add these commits on to the updated template collection. This helps track your customizations and replay them on future template updates.
When you update the undercloud, the
openstack-tripleo-heat-templatespackage might also receive updates. When this occurs, you must also update your custom template collection:Save the
openstack-tripleo-heat-templatespackage version as an environment variable:export PACKAGE=$(rpm -qv openstack-tripleo-heat-templates)
$ export PACKAGE=$(rpm -qv openstack-tripleo-heat-templates)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change to your template collection directory and create a new branch for the updated templates:
cd ~/templates/openstack-tripleo-heat-templates git checkout -b $PACKAGE
$ cd ~/templates/openstack-tripleo-heat-templates $ git checkout -b $PACKAGECopy to Clipboard Copied! Toggle word wrap Toggle overflow Remove all files in the branch and replace them with the new versions:
git rm -rf * cp -r /usr/share/openstack-tripleo-heat-templates/* .
$ git rm -rf * $ cp -r /usr/share/openstack-tripleo-heat-templates/* .Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add all templates for the initial commit:
git add *
$ git add *Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a commit for the package update:
git commit -m "Updates for $PACKAGE"
$ git commit -m "Updates for $PACKAGE"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Merge the branch into master. If you use a Git management system (such as GitLab), use the management workflow. If you use git locally, merge by switching to the
masterbranch and run thegit mergecommand:git checkout master git merge $PACKAGE
$ git checkout master $ git merge $PACKAGECopy to Clipboard Copied! Toggle word wrap Toggle overflow
The master branch now contains the latest version of the core template collection. You can now rebase the my-customization branch from this updated collection.
Update the
my-customizationbranch,:Change to the
my-customizationsbranch:git checkout my-customizations
$ git checkout my-customizationsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Rebase the branch off
master:git rebase master
$ git rebase masterCopy to Clipboard Copied! Toggle word wrap Toggle overflow This updates the
my-customizationsbranch and replays the custom commits made to this branch.
Resolve any conflicts that occur during the rebase:
Check which files contain the conflicts:
git status
$ git statusCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Resolve the conflicts of the template files identified.
Add the resolved files:
git add [resolved files]
$ git add [resolved files]Copy to Clipboard Copied! Toggle word wrap Toggle overflow Continue the rebase:
git rebase --continue
$ git rebase --continueCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Deploy the custom template collection:
Ensure that you have switched to the
my-customizationbranch:git checkout my-customizations
git checkout my-customizationsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
openstack overcloud deploycommand with the--templatesoption to specify your local template directory:openstack overcloud deploy --templates /home/stack/templates/openstack-tripleo-heat-templates [OTHER OPTIONS]
$ openstack overcloud deploy --templates /home/stack/templates/openstack-tripleo-heat-templates [OTHER OPTIONS]Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Director uses the default template directory (/usr/share/openstack-tripleo-heat-templates) if you specify the --templates option without a directory.
Red Hat recommends using the methods in Section 10.3, “Configuration hooks” instead of modifying the heat template collection.
10.1.6. Jinja2 rendering Copia collegamentoCollegamento copiato negli appunti!
The core heat templates in /usr/share/openstack-tripleo-heat-templates contain a number of files that have the j2.yaml file extension. These files contain Jinja2 template syntax and director renders these files to their static heat template equivalents that have the .yaml extension. For example, the main overcloud.j2.yaml file renders into overcloud.yaml. Director uses the resulting overcloud.yaml file.
The Jinja2-enabled heat templates use Jinja2 syntax to create parameters and resources for iterative values. For example, the overcloud.j2.yaml file contains the following snippet:
When director renders the Jinja2 syntax, director iterates over the roles defined in the roles_data.yaml file and populates the {{role.name}}Count parameter with the name of the role. The default roles_data.yaml file contains five roles and results in the following parameters from our example:
-
ControllerCount -
ComputeCount -
BlockStorageCount -
ObjectStorageCount -
CephStorageCount
A example rendered version of the parameter looks like this:
Director renders Jinja2-enabled templates and environment files only from within the directory of your core heat templates. The following use cases demonstrate the correct method to render the Jinja2 templates.
Use case 1: Default core templates
Template directory: /usr/share/openstack-tripleo-heat-templates/
Environment file: /usr/share/openstack-tripleo-heat-templates/environments/ssl/enable-internal-tls.j2.yaml
Director uses the default core template location (--templates) and renders the enable-internal-tls.j2.yaml file into enable-internal-tls.yaml. When you run the openstack overcloud deploy command, use the -e option to include the name of the rendered enable-internal-tls.yaml file.
openstack overcloud deploy --templates \
-e /usr/share/openstack-tripleo-heat-templates/environments/ssl/enable-internal-tls.yaml
$ openstack overcloud deploy --templates \
-e /usr/share/openstack-tripleo-heat-templates/environments/ssl/enable-internal-tls.yaml
...
Use case 2: Custom core templates
Template directory: /home/stack/tripleo-heat-installer-templates
Environment file: /home/stack/tripleo-heat-installer-templates/environments/ssl/enable-internal-tls.j2.yaml
Director uses a custom core template location (--templates /home/stack/tripleo-heat-templates) and director renders the enable-internal-tls.j2.yaml file within the custom core templates into enable-internal-tls.yaml. When you run the openstack overcloud deploy command, use the -e option to include the name of the rendered enable-internal-tls.yaml file.
openstack overcloud deploy --templates /home/stack/tripleo-heat-templates \
-e /home/stack/tripleo-heat-templates/environments/ssl/enable-internal-tls.yaml
$ openstack overcloud deploy --templates /home/stack/tripleo-heat-templates \
-e /home/stack/tripleo-heat-templates/environments/ssl/enable-internal-tls.yaml
...
Use case 3: Incorrect usage
Template directory: /usr/share/openstack-tripleo-heat-templates/
Environment file: /home/stack/tripleo-heat-installer-templates/environments/ssl/enable-internal-tls.j2.yaml
Director uses a custom core template location (--templates /home/stack/tripleo-heat-installer-templates). However, the chosen enable-internal-tls.j2.yaml is not located within the custom core templates, so it will not render into enable-internal-tls.yaml. This causes the deployment to fail.
Processing Jinja2 syntax into static templates
Use the process-templates.py script to render the Jinja2 syntax of the openstack-tripleo-heat-templates into a set of static templates. To render a copy of the openstack-tripleo-heat-templates collection with the process-templates.py script, change to the openstack-tripleo-heat-templates directory:
cd /usr/share/openstack-tripleo-heat-templates
$ cd /usr/share/openstack-tripleo-heat-templates
Run the process-templates.py script, which is located in the tools directory, along with the -o option to define a custom directory to save the static copy:
./tools/process-templates.py -o ~/openstack-tripleo-heat-templates-rendered
$ ./tools/process-templates.py -o ~/openstack-tripleo-heat-templates-rendered
This converts all Jinja2 templates to their rendered YAML versions and saves the results to ~/openstack-tripleo-heat-templates-rendered.
10.2. Heat parameters Copia collegamentoCollegamento copiato negli appunti!
Each heat template in the director template collection contains a parameters section. This section contains definitions for all parameters specific to a particular overcloud service. This includes the following:
-
overcloud.j2.yaml- Default base parameters -
roles_data.yaml- Default parameters for composable roles -
deployment/*.yaml- Default parameters for specific services
You can modify the values for these parameters using the following method:
- Create an environment file for your custom parameters.
-
Include your custom parameters in the
parameter_defaultssection of the environment file. -
Include the environment file with the
openstack overcloud deploycommand.
10.2.1. Example 1: Configuring the time zone Copia collegamentoCollegamento copiato negli appunti!
The Heat template for setting the timezone (puppet/services/time/timezone.yaml) contains a TimeZone parameter. If you leave the TimeZone parameter blank, the overcloud sets the time to UTC as a default.
To obtain lists of timezones run the timedatectl list-timezones command. The following example command retrieves the timezones for Asia:
sudo timedatectl list-timezones|grep "Asia"
$ sudo timedatectl list-timezones|grep "Asia"
After you identify your timezone, set the TimeZone parameter in an environment file. The following example environment file sets the value of TimeZone to Asia/Tokyo:
parameter_defaults: TimeZone: 'Asia/Tokyo'
parameter_defaults:
TimeZone: 'Asia/Tokyo'
10.2.2. Example 2: Configuring RabbitMQ file descriptor limit Copia collegamentoCollegamento copiato negli appunti!
For certain configurations, you might need to increase the file descriptor limit for the RabbitMQ server. Use the deployment/rabbitmq/rabbitmq-container-puppet.yaml heat template to set a new limit in the RabbitFDLimit parameter. Add the following entry to an environment file:
parameter_defaults: RabbitFDLimit: 65536
parameter_defaults:
RabbitFDLimit: 65536
10.2.3. Example 3: Enabling and disabling parameters Copia collegamentoCollegamento copiato negli appunti!
You might need to initially set a parameter during a deployment, then disable the parameter for a future deployment operation, such as updates or scaling operations. For example, to include a custom RPM during the overcloud creation, include the following entry in an environment file:
parameter_defaults: DeployArtifactURLs: ["http://www.example.com/myfile.rpm"]
parameter_defaults:
DeployArtifactURLs: ["http://www.example.com/myfile.rpm"]
To disable this parameter from a future deployment, it is not sufficient to remove the parameter. Instead, you must set the parameter to an empty value:
parameter_defaults: DeployArtifactURLs: []
parameter_defaults:
DeployArtifactURLs: []
This ensures the parameter is no longer set for subsequent deployments operations.
10.2.4. Example 4: Role-based parameters Copia collegamentoCollegamento copiato negli appunti!
Use the [ROLE]Parameters parameters, replacing [ROLE] with a composable role, to set parameters for a specific role.
For example, director configures sshd on both Controller and Compute nodes. To set a different sshd parameters for Controller and Compute nodes, create an environment file that contains both the ControllerParameters and ComputeParameters parameter and set the sshd parameters for each specific role:
parameter_defaults:
ControllerParameters:
BannerText: "This is a Controller node"
ComputeParameters:
BannerText: "This is a Compute node"
parameter_defaults:
ControllerParameters:
BannerText: "This is a Controller node"
ComputeParameters:
BannerText: "This is a Compute node"
10.2.5. Identifying parameters that you want to modify Copia collegamentoCollegamento copiato negli appunti!
Red Hat OpenStack Platform director provides many parameters for configuration. In some cases, you might experience difficulty identifying a certain option that you want to configure, and the corresponding director parameter. If there is an option that you want to configure with director, use the following workflow to identify and map the option to a specific overcloud parameter:
- Identify the option that you want to configure. Make a note of the service that uses the option.
Check the corresponding Puppet module for this option. The Puppet modules for Red Hat OpenStack Platform are located under
/etc/puppet/moduleson the director node. Each module corresponds to a particular service. For example, thekeystonemodule corresponds to the OpenStack Identity (keystone).- If the Puppet module contains a variable that controls the chosen option, move to the next step.
- If the Puppet module does not contain a variable that controls the chosen option, no hieradata exists for this option. If possible, you can set the option manually after the overcloud completes deployment.
Check the core heat template collection for the Puppet variable in the form of hieradata. The templates in
deployment/*usually correspond to the Puppet modules of the same services. For example, thedeployment/keystone/keystone-container-puppet.yamltemplate provides hieradata to thekeystonemodule.- If the heat template sets hieradata for the Puppet variable, the template should also disclose the director-based parameter that you can modify.
- If the heat template does not set hieradata for the Puppet variable, use the configuration hooks to pass the hieradata using an environment file. See Section 10.3.4, “Puppet: Customizing hieradata for roles” for more information on customizing hieradata.
Procedure
To change the notification format for OpenStack Identity (keystone), use the workflow and complete the following steps:
-
Identify the OpenStack parameter that you want to configure (
notification_format). Search the
keystonePuppet module for thenotification_formatsetting:grep notification_format /etc/puppet/modules/keystone/manifests/*
$ grep notification_format /etc/puppet/modules/keystone/manifests/*Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this case, the
keystonemodule manages this option using thekeystone::notification_formatvariable.Search the
keystoneservice template for this variable:grep "keystone::notification_format" /usr/share/openstack-tripleo-heat-templates/deployment/keystone/keystone-container-puppet.yaml
$ grep "keystone::notification_format" /usr/share/openstack-tripleo-heat-templates/deployment/keystone/keystone-container-puppet.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output shows that director uses the
KeystoneNotificationFormatparameter to set thekeystone::notification_formathieradata.
-
Identify the OpenStack parameter that you want to configure (
The following table shows the eventual mapping:
| Director parameter | Puppet hieradata | OpenStack Identity (keystone) option |
|---|---|---|
|
|
|
|
You set the KeystoneNotificationFormat in an overcloud environment file, which then sets the notification_format option in the keystone.conf file during the overcloud configuration.
10.3. Configuration hooks Copia collegamentoCollegamento copiato negli appunti!
Use configuration hooks to inject your own custom configuration functions into the overcloud deployment process. You can create hooks to inject custom configuration before and after the main overcloud services configuration, and hooks for modifying and including Puppet-based configuration.
10.3.1. Pre-configuration: customizing specific overcloud roles Copia collegamentoCollegamento copiato negli appunti!
The overcloud uses Puppet for the core configuration of OpenStack components. Director provides a set of hooks that you can use to perform custom configuration for specific node roles before the core configuration begins. These hooks include the following configurations:
Previous versions of this document used the OS::TripleO::Tasks::*PreConfig resources to provide pre-configuration hooks on a per role basis. The heat template collection requires dedicated use of these hooks, which means that you should not use them for custom use. Instead, use the OS::TripleO::*ExtraConfigPre hooks outlined here.
- OS::TripleO::ControllerExtraConfigPre
- Additional configuration applied to Controller nodes before the core Puppet configuration.
- OS::TripleO::ComputeExtraConfigPre
- Additional configuration applied to Compute nodes before the core Puppet configuration.
- OS::TripleO::CephStorageExtraConfigPre
- Additional configuration applied to Ceph Storage nodes before the core Puppet configuration.
- OS::TripleO::ObjectStorageExtraConfigPre
- Additional configuration applied to Object Storage nodes before the core Puppet configuration.
- OS::TripleO::BlockStorageExtraConfigPre
- Additional configuration applied to Block Storage nodes before the core Puppet configuration.
- OS::TripleO::[ROLE]ExtraConfigPre
-
Additional configuration applied to custom nodes before the core Puppet configuration. Replace
[ROLE]with the composable role name.
In this example, append the resolv.conf file on all nodes of a particular role with a variable nameserver:
Procedure
Create a basic heat template
~/templates/nameserver.yamlthat runs a script to write a variable nameserver to theresolv.conffile of a node:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, the
resourcessection contains the following parameters:- CustomExtraConfigPre
-
This defines a software configuration. In this example, we define a Bash
scriptand heat replaces_NAMESERVER_IP_with the value stored in thenameserver_ipparameter. - CustomExtraDeploymentPre
This executes a software configuration, which is the software configuration from the
CustomExtraConfigPreresource. Note the following:-
The
configparameter references theCustomExtraConfigPreresource so that heat knows which configuration to apply. -
The
serverparameter retrieves a map of the overcloud nodes. This parameter is provided by the parent template and is mandatory in templates for this hook. -
The
actionsparameter defines when to apply the configuration. Use the defaultCREATEvalue to apply the configuration when the overcloud is created. -
input_valuescontains a parameter calleddeploy_identifier, which stores theDeployIdentifierfrom the parent template. This parameter provides a timestamp to the resource for each deployment update to ensure that the resource reapplies on subsequent overcloud updates.
-
The
Create an environment file
~/templates/pre_config.yamlthat registers your heat template to the role-based resource type. For example, to apply the configuration only to Controller nodes, use theControllerExtraConfigPrehook:resource_registry: OS::TripleO::ControllerExtraConfigPre: /home/stack/templates/nameserver.yaml parameter_defaults: nameserver_ip: 192.168.1.1
resource_registry: OS::TripleO::ControllerExtraConfigPre: /home/stack/templates/nameserver.yaml parameter_defaults: nameserver_ip: 192.168.1.1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the environment file to the stack, along with your other environment files:
openstack overcloud deploy --templates \ ...$ openstack overcloud deploy --templates \ ... -e /home/stack/templates/pre_config.yaml \ ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow This applies the configuration to all Controller nodes before the core configuration begins on either the initial overcloud creation or subsequent updates.
You can register each resource to only one heat template per hook. Subsequent usage overrides the heat template to use.
10.3.2. Pre-configuration: customizing all overcloud roles Copia collegamentoCollegamento copiato negli appunti!
The overcloud uses Puppet for the core configuration of OpenStack components. Director provides a hook that you can use to configure all node types before the core configuration begins:
- OS::TripleO::NodeExtraConfig
- Additional configuration applied to all nodes roles before the core Puppet configuration.
In this example, append the resolv.conf file on each node with a variable nameserver:
Procedure
Create a basic heat template
~/templates/nameserver.yamlthat runs a script to append theresolv.conffile of each node with a variable nameserver:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, the
resourcessection contains the following parameters:- CustomExtraConfigPre
-
This parameter defines a software configuration. In this example, you define a Bash
scriptand heat replaces_NAMESERVER_IP_with the value stored in thenameserver_ipparameter. - CustomExtraDeploymentPre
This parameter executes a software configuration, which is the software configuration from the
CustomExtraConfigPreresource. Note the following:-
The
configparameter references theCustomExtraConfigPreresource so that heat knows which configuration to apply. -
The
serverparameter retrieves a map of the overcloud nodes. This parameter is provided by the parent template and is mandatory in templates for this hook. -
The
actionsparameter defines when to apply the configuration. Use the defaultCREATEvalue to apply the configuration when the overcloud is created. -
The
input_valuesparameter contains a sub-parameter calleddeploy_identifier, which stores theDeployIdentifierfrom the parent template. This parameter provides a timestamp to the resource for each deployment update to ensure that the resource reapplies on subsequent overcloud updates.
-
The
Create an environment file
~/templates/pre_config.yamlthat registers your heat template as theOS::TripleO::NodeExtraConfigresource type.resource_registry: OS::TripleO::NodeExtraConfig: /home/stack/templates/nameserver.yaml parameter_defaults: nameserver_ip: 192.168.1.1
resource_registry: OS::TripleO::NodeExtraConfig: /home/stack/templates/nameserver.yaml parameter_defaults: nameserver_ip: 192.168.1.1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the environment file to the stack, along with your other environment files:
openstack overcloud deploy --templates \ ...$ openstack overcloud deploy --templates \ ... -e /home/stack/templates/pre_config.yaml \ ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow This applies the configuration to all nodes before the core configuration begins on either the initial overcloud creation or subsequent updates.
You can register the OS::TripleO::NodeExtraConfig to only one heat template. Subsequent usage overrides the heat template to use.
10.3.3. Post-configuration: customizing all overcloud roles Copia collegamentoCollegamento copiato negli appunti!
Previous versions of this document used the OS::TripleO::Tasks::*PostConfig resources to provide post-configuration hooks on a per role basis. The heat template collection requires dedicated use of these hooks, which means that you should not use them for custom use. Instead, use the OS::TripleO::NodeExtraConfigPost hook outlined here.
A situation might occur where you have completed the creation of your overcloud but you want to add additional configuration to all roles, either on initial creation or on a subsequent update of the overcloud. In this case, use the following post-configuration hook:
- OS::TripleO::NodeExtraConfigPost
- Additional configuration applied to all nodes roles after the core Puppet configuration.
In this example, append the resolv.conf file on each node with a variable nameserver:
Procedure
Create a basic heat template
~/templates/nameserver.yamlthat runs a script to append theresolv.conffile of each node with a variable nameserver:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, the
resourcessection contains the following parameters:- CustomExtraConfig
-
This defines a software configuration. In this example, you define a Bash
scriptand heat replaces_NAMESERVER_IP_with the value stored in thenameserver_ipparameter. - CustomExtraDeployments
This executes a software configuration, which is the software configuration from the
CustomExtraConfigresource. Note the following:-
The
configparameter references theCustomExtraConfigresource so that heat knows which configuration to apply. -
The
serversparameter retrieves a map of the overcloud nodes. This parameter is provided by the parent template and is mandatory in templates for this hook. -
The
actionsparameter defines when to apply the configuration. Use the defaultCREATEvalue to apply the configuration when the overcloud is created. -
input_valuescontains a parameter calleddeploy_identifier, which stores theDeployIdentifierfrom the parent template. This parameter provides a timestamp to the resource for each deployment update to ensure that the resource reapplies on subsequent overcloud updates.
-
The
Create an environment file
~/templates/post_config.yamlthat registers your heat template as theOS::TripleO::NodeExtraConfigPost:resource type.resource_registry: OS::TripleO::NodeExtraConfigPost: /home/stack/templates/nameserver.yaml parameter_defaults: nameserver_ip: 192.168.1.1
resource_registry: OS::TripleO::NodeExtraConfigPost: /home/stack/templates/nameserver.yaml parameter_defaults: nameserver_ip: 192.168.1.1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the environment file to the stack, along with your other environment files:
openstack overcloud deploy --templates \ ...$ openstack overcloud deploy --templates \ ... -e /home/stack/templates/post_config.yaml \ ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow This applies the configuration to all nodes after the core configuration completes on either initial overcloud creation or subsequent updates.
You can register the OS::TripleO::NodeExtraConfigPost to only one heat template. Subsequent usage overrides the heat template to use.
10.3.4. Puppet: Customizing hieradata for roles Copia collegamentoCollegamento copiato negli appunti!
The heat template collection contains a set of parameters that you can use to pass extra configuration to certain node types. These parameters save the configuration as hieradata for the Puppet configuration on the node:
- ControllerExtraConfig
- Configuration to add to all Controller nodes.
- ComputeExtraConfig
- Configuration to add to all Compute nodes.
- BlockStorageExtraConfig
- Configuration to add to all Block Storage nodes.
- ObjectStorageExtraConfig
- Configuration to add to all Object Storage nodes.
- CephStorageExtraConfig
- Configuration to add to all Ceph Storage nodes.
- [ROLE]ExtraConfig
-
Configuration to add to a composable role. Replace
[ROLE]with the composable role name. - ExtraConfig
- Configuration to add to all nodes.
Procedure
To add extra configuration to the post-deployment configuration process, create an environment file that contains these parameters in the
parameter_defaultssection. For example, to increase the reserved memory for Compute hosts to 1024 MB and set the VNC keymap to Japanese, use the following entries in theComputeExtraConfigparameter:parameter_defaults: ComputeExtraConfig: nova::compute::reserved_host_memory: 1024 nova::compute::vnc_keymap: japarameter_defaults: ComputeExtraConfig: nova::compute::reserved_host_memory: 1024 nova::compute::vnc_keymap: jaCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Include this environment file in the
openstack overcloud deploycommand, along with any other environment files relevant to your deployment.
You can define each parameter only once. Subsequent usage overrides previous values.
10.3.5. Puppet: Customizing hieradata for individual nodes Copia collegamentoCollegamento copiato negli appunti!
You can set Puppet hieradata for individual nodes using the heat template collection:
Procedure
Identify the system UUID from the introspection data for a node:
openstack baremetal introspection data save 9dcc87ae-4c6d-4ede-81a5-9b20d7dc4a14 | jq .extra.system.product.uuid
$ openstack baremetal introspection data save 9dcc87ae-4c6d-4ede-81a5-9b20d7dc4a14 | jq .extra.system.product.uuidCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command returns a system UUID. For example:
"f5055c6c-477f-47fb-afe5-95c6928c407f"
"f5055c6c-477f-47fb-afe5-95c6928c407f"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an environment file to define node-specific hieradata and register the
per_node.yamltemplate to a pre-configuration hook. Include the system UUID of the node that you want to configure in theNodeDataLookupparameter:resource_registry: OS::TripleO::ComputeExtraConfigPre: /usr/share/openstack-tripleo-heat-templates/puppet/extraconfig/pre_deploy/per_node.yaml parameter_defaults: NodeDataLookup: '{"f5055c6c-477f-47fb-afe5-95c6928c407f": {"nova::compute::vcpu_pin_set": [ "2", "3" ]}}'resource_registry: OS::TripleO::ComputeExtraConfigPre: /usr/share/openstack-tripleo-heat-templates/puppet/extraconfig/pre_deploy/per_node.yaml parameter_defaults: NodeDataLookup: '{"f5055c6c-477f-47fb-afe5-95c6928c407f": {"nova::compute::vcpu_pin_set": [ "2", "3" ]}}'Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Include this environment file in the
openstack overcloud deploycommand, along with any other environment files relevant to your deployment.
The per_node.yaml template generates a set of hieradata files on nodes that correspond to each system UUID and contains the hieradata that you define. If a UUID is not defined, the resulting hieradata file is empty. In this example, the per_node.yaml template runs on all Compute nodes as defined by the OS::TripleO::ComputeExtraConfigPre hook, but only the Compute node with system UUID f5055c6c-477f-47fb-afe5-95c6928c407f receives hieradata.
You can use this mechanism to tailor each node according to specific requirements.
10.3.6. Puppet: Applying custom manifests Copia collegamentoCollegamento copiato negli appunti!
In certain circumstances, you might want to install and configure some additional components on your overcloud nodes. You can achieve this with a custom Puppet manifest that applies to nodes after the main configuration completes. As a basic example, you might want to install motd on each node
Procedure
Create a heat template
~/templates/custom_puppet_config.yamlthat launches Puppet configuration.Copy to Clipboard Copied! Toggle word wrap Toggle overflow This example includes the
/home/stack/templates/motd.ppwithin the template and passes it to nodes for configuration. Themotd.ppfile contains the Puppet classes necessary to install and configuremotd.Create an environment file
~templates/puppet_post_config.yamlthat registers your heat template as theOS::TripleO::NodeExtraConfigPost:resource type.resource_registry: OS::TripleO::NodeExtraConfigPost: /home/stack/templates/custom_puppet_config.yaml
resource_registry: OS::TripleO::NodeExtraConfigPost: /home/stack/templates/custom_puppet_config.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Include this environment file in the
openstack overcloud deploycommand, along with any other environment files relevant to your deployment.openstack overcloud deploy --templates \ ...$ openstack overcloud deploy --templates \ ... -e /home/stack/templates/puppet_post_config.yaml \ ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow This applies the configuration from
motd.ppto all nodes in the overcloud.