Este conteúdo não está disponível no idioma selecionado.
Chapter 9. Configuring and managing Red Hat OpenStack Platform with Ansible
You can use Ansible to configure and register the overcloud, and to manage containers.
9.1. Ansible-based overcloud registration Copiar o linkLink copiado para a área de transferência!
Director uses Ansible-based methods to register overcloud nodes to the Red Hat Customer Portal or to a Red Hat Satellite Server.
I:f you used the rhel-registration method from previous Red Hat OpenStack Platform versions, you must disable it and switch to the Ansible-based method. For more information, see Section 9.1.6, “Switching to the rhsm composable service” and Section 9.1.7, “rhel-registration to rhsm mappings”.
In addition to the director-based registration method, you can also manually register after deployment. For more information, see Section 9.1.9, “Running Ansible-based registration manually”
9.1.1. Red Hat Subscription Manager (RHSM) composable service Copiar o linkLink copiado para a área de transferência!
You can use the rhsm composable service 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 you can use to define multiple sub-parameters relevant to your registration:
You can also use the RhsmVars parameter in combination with role-specific parameters, for example, ControllerParameters, to provide flexibility when enabling specific repositories for different nodes types.
RhsmVars sub-parameters
Use the following sub-parameters as part of the RhsmVars parameter when you configure the rhsm composable service. For more information about the Ansible parameters that are available, see the role documentation.
rhsm | Description |
|---|---|
|
|
Choose the registration method. Either |
|
|
The organization that you want to use for registration. To locate this ID, run |
|
|
The subscription pool ID that you want to use. Use this parameter if you do not want to auto-attach subscriptions. To locate this ID, run |
|
| The activation key that you want to use for registration. |
|
|
Use this parameter to attach compatible subscriptions to this system automatically. Set the value to |
|
| The base URL for obtaining content. The default URL is the Red Hat Content Delivery Network. If you use 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 you use a Satellite server, change this value to your Satellite server hostname. |
|
| A list of repositories that you want to enable. |
|
| The username for registration. If possible, use activation keys for registration. |
|
| The password for registration. If possible, use activation keys for registration. |
|
| Red Hat Enterprise Linux release for pinning the repositories. This is set to 9.2 for Red Hat OpenStack Platform |
|
|
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. |
You can use rhsm_activation_key and rhsm_repos together only if rhsm_method is set to portal. If rhsm_method is set to satellite, you can only use either rhsm_activation_key or rhsm_repos.
9.1.2. RhsmVars sub-parameters Copiar o linkLink copiado para a área de transferência!
Use the following sub-parameters as part of the RhsmVars parameter when you configure the rhsm composable service. For more information about the Ansible parameters that are available, see the role documentation.
rhsm | Description |
|---|---|
|
|
Choose the registration method. Either |
|
|
The organization that you want to use for registration. To locate this ID, run |
|
|
The subscription pool ID that you want to use. Use this parameter if you do not want to auto-attach subscriptions. To locate this ID, run |
|
| The activation key that you want to use for registration. |
|
|
Use this parameter to attach compatible subscriptions to this system automatically. Set the value to |
|
| The base URL for obtaining content. The default URL is the Red Hat Content Delivery Network. If you use 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 you use a Satellite server, change this value to your Satellite server hostname. |
|
| A list of repositories that you want to enable. |
|
| The username for registration. If possible, use activation keys for registration. |
|
| The password for registration. If possible, use activation keys for registration. |
|
| Red Hat Enterprise Linux release for pinning the repositories. This is set to 9.2 for Red Hat OpenStack Platform |
|
|
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. |
You can use rhsm_activation_key and rhsm_repos together only if rhsm_method is set to portal. If rhsm_method is set to satellite, you can only use either rhsm_activation_key or rhsm_repos.
9.1.3. Registering the overcloud with the rhsm composable service Copiar o linkLink copiado para a área de transferência!
Create an environment file that enables and configures the rhsm composable service. Director uses this environment file to register and subscribe your nodes.
Procedure
-
Create an environment file named
templates/rhsm.ymlto store the configuration. Include your configuration in the environment file. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The
resource_registrysection associates 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.
-
The
To apply the
rhsmcomposable service on a per-role basis, include your configuration in the environment file. For example, you can apply different sets of configurations to Controller nodes, Compute nodes, and Ceph Storage nodes:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
ControllerParameters,ComputeParameters, andCephStorageParametersparameters each use a separateRhsmVarsparameter 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 Enhanced Extended Update Service (EEUS) repositories that Controller and Compute nodes require.- Save the environment file.
9.1.4. Applying the rhsm composable service to different roles Copiar o linkLink copiado para a área de transferência!
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 named
templates/rhsm.ymlto 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, andCephStorageParametersparameters each use a separateRhsmVarsparameter 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 Enhanced Extended Update Service (EEUS) repositories that Controller and Compute nodes require.- Save the environment file.
9.1.5. Registering the overcloud to Red Hat Satellite Server Copiar o linkLink copiado para a área de transferência!
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 named
templates/rhsm.ymlto 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.
9.1.6. Switching to the rhsm composable service Copiar o linkLink copiado para a área de transferência!
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.
9.1.7. rhel-registration to rhsm mappings Copiar o linkLink copiado para a área de transferência!
To help transition your details from the rhel-registration method to the rhsm method, use the following table to map your parameters and values.
rhel-registration | rhsm / RhsmVars |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9.1.8. Deploying the overcloud with the rhsm composable service Copiar o linkLink copiado para a área de transferência!
Deploy the overcloud with the rhsm composable service so that Ansible controls the registration process for your overcloud nodes.
Procedure
Include
rhsm.ymlenvironment file with theopenstack overcloud deploycommand: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 in to 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
9.1.9. Running Ansible-based registration manually Copiar o linkLink copiado para a área de transferência!
You can perform manual Ansible-based registration on a deployed overcloud with the dynamic inventory script on the director node. Use this script to define node roles as host groups and then run a playbook against them with ansible-playbook. Use the following example playbook to register Controller nodes manually.
Procedure
Create a playbook that uses 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.
- Disable any auto-enabled repositories.
-
Enable only the repositories relevant to the Controller node. The repositories are listed with the
reposvariable.
After you deploy 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 performs the following actions:
- 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
hostsparameter of the playbook, which in this case is the Controller group.
9.2. Configuring the overcloud with Ansible Copiar o linkLink copiado para a área de transferência!
Ansible is the main method to apply the overcloud configuration. This chapter provides information about how to interact with the overcloud Ansible configuration.
Although director generates the Ansible playbooks automatically, it is a good idea to familiarize yourself with Ansible syntax. For more information about using Ansible, see https://docs.ansible.com/.
Ansible also uses the concept of roles, which are different to OpenStack Platform director roles. Ansible roles form reusable components of playbooks, whereas director roles contain mappings of OpenStack services to node types.
9.2.1. Ansible-based overcloud configuration (config-download) Copiar o linkLink copiado para a área de transferência!
The config-download feature is the method that director uses to configure the overcloud. Director uses config-download in conjunction with OpenStack Orchestration (heat) to generate the software configuration and apply the configuration to each overcloud node. Although heat creates all deployment data from SoftwareDeployment resources to perform the overcloud installation and configuration, heat does not apply any of the configuration. Heat only provides the configuration data through the heat API.
As a result, when you run the openstack overcloud deploy command, the following process occurs:
-
Director creates a new deployment plan based on
openstack-tripleo-heat-templatesand includes any environment files and parameters to customize the plan. - Director uses heat to interpret the deployment plan and create the overcloud stack and all descendant resources. This includes provisioning nodes with the OpenStack Bare Metal service (ironic).
- Heat also creates the software configuration from the deployment plan. Director compiles the Ansible playbooks from this software configuration.
-
Director generates a temporary user (
tripleo-admin) on the overcloud nodes specifically for Ansible SSH access. - Director downloads the heat software configuration and generates a set of Ansible playbooks using heat outputs.
-
Director applies the Ansible playbooks to the overcloud nodes using
ansible-playbook.
9.2.2. config-download working directory Copiar o linkLink copiado para a área de transferência!
The ansible-playbook command creates an Ansible project directory, default name ~/config-download/overcloud. This project directory stores downloaded software configuration from heat. It includes all Ansible-related files which you need to run ansible-playbook to configure the overcloud.
The contents of the directory include:
-
tripleo-ansible-inventory.yaml - Ansible inventory file containing
hostsandvarsfor all the overcloud nodes. -
ansible.log - Log file from the most recent run of
ansible-playbook. -
ansible.cfg - Configuration file used when running
ansible-playbook. -
ansible-playbook-command.sh - Executable script used to rerun
ansible-playbook. ssh_private_key - Private ssh key used to access the overcloud nodes.
- Reproducing ansible-playbook
After the project directory is created, run the ansible-playbook-command.sh command to reproduce the deployment.
./ansible-playbook-command.sh
$ ./ansible-playbook-command.sh
You can run the script with additional arguments, such as check mode --check, limiting hosts --limit, and overriding variables -e.
./ansible-playbook-command.sh --check
$ ./ansible-playbook-command.sh --check
9.2.3. Checking config-download log Copiar o linkLink copiado para a área de transferência!
During the config-download process, Ansible creates a log file, named ansible.log, in the /home/stack directory on the undercloud.
Procedure
View the log with the
lesscommand:less ~/ansible.log
$ less ~/ansible.logCopy to Clipboard Copied! Toggle word wrap Toggle overflow
9.2.4. Performing Git operations on the working directory Copiar o linkLink copiado para a área de transferência!
The config-download working directory is a local Git repository. Every time a deployment operation runs, director adds a Git commit to the working directory with the relevant changes. You can perform Git operations to view configuration for the deployment at different stages and compare the configuration with different deployments.
Be aware of the limitations of the working directory. For example, if you use Git to revert to a previous version of the config-download working directory, this action affects only the configuration in the working directory. It does not affect the following configurations:
- The overcloud data schema: Applying a previous version of the working directory software configuration does not undo data migration and schema changes.
- The hardware layout of the overcloud: Reverting to previous software configuration does not undo changes related to overcloud hardware, such as scaling up or down.
-
The heat stack: Reverting to earlier revisions of the working directory has no effect on the configuration stored in the heat stack. The heat stack creates a new version of the software configuration that applies to the overcloud. To make permanent changes to the overcloud, modify the environment files applied to the overcloud stack before you rerun the
openstack overcloud deploycommand.
Complete the following steps to compare different commits of the config-download working directory.
Procedure
Change to the
config-downloadworking directory for your overcloud, usually namedovercloud:cd ~/config-download/overcloud
$ cd ~/config-download/overcloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
git logcommand to list the commits in your working directory. You can also format the log output to show the date:git log --format=format:"%h%x09%cd%x09"
$ git log --format=format:"%h%x09%cd%x09" a7e9063 Mon Oct 8 21:17:52 2018 +1000 dfb9d12 Fri Oct 5 20:23:44 2018 +1000 d0a910b Wed Oct 3 19:30:16 2018 +1000 ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, the most recent commit appears first.
Run the
git diffcommand against two commit hashes to see all changes between the deployments:git diff a7e9063 dfb9d12
$ git diff a7e9063 dfb9d12Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9.2.5. Deployment methods that use config-download Copiar o linkLink copiado para a área de transferência!
There are four main methods that use config-download in the context of an overcloud deployment:
- Standard deployment
-
Run the
openstack overcloud deploycommand to automatically run the configuration stage after the provisioning stage. This is the default method when you run theopenstack overcloud deploycommand. - Separate provisioning and configuration
-
Run the
openstack overcloud deploycommand with specific options to separate the provisioning and configuration stages. - Run the ansible-playbook-command.sh script after a deployment
-
Run the
openstack overcloud deploycommand with combined or separate provisioning and configuration stages, then run theansible-playbook-command.shscript supplied in theconfig-downloadworking directory to re-apply the configuration stage. - Provision nodes, manually create config-download, and run Ansible
-
Run the
openstack overcloud deploycommand with a specific option to provision nodes, then run theansible-playbookcommand with thedeploy_steps_ansible-playbook.yamlplaybook.
9.2.6. Running config-download on a standard deployment Copiar o linkLink copiado para a área de transferência!
The default method for executing config-download is to run the openstack overcloud deploy command. This method suits most environments.
Prerequisites
- A successful undercloud installation.
- Overcloud nodes ready for deployment.
- Heat environment files that are relevant to your specific overcloud customization.
Procedure
-
Log in to the undercloud host as the
stackuser. Source the
stackrcfile:source ~/stackrc
$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the deployment command. Include any environment files that you require for your overcloud:
openstack overcloud deploy \ --templates \ -e environment-file1.yaml \ -e environment-file2.yaml \ ...
$ openstack overcloud deploy \ --templates \ -e environment-file1.yaml \ -e environment-file2.yaml \ ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Wait until the deployment process completes.
During the deployment process, director generates the config-download files in a ~/config-download/overcloud working directory. After the deployment process finishes, view the Ansible playbooks in the working directory to see the tasks director executed to configure the overcloud.
9.2.7. Running config-download with separate provisioning and configuration Copiar o linkLink copiado para a área de transferência!
The openstack overcloud deploy command runs the heat-based provisioning process and then the config-download configuration process. You can also run the deployment command to execute each process individually. Use this method to provision your overcloud nodes as a distinct process so that you can perform any manual pre-configuration tasks on the nodes before you run the overcloud configuration process.
Prerequisites
- A successful undercloud installation.
- Overcloud nodes ready for deployment.
- Heat environment files that are relevant to your specific overcloud customization.
Procedure
-
Log in to the undercloud host as the
stackuser. Source the
stackrcfile:source ~/stackrc
$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the deployment command with the
--stack-onlyoption. Include any environment files you require for your overcloud:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Wait until the provisioning process completes.
Enable SSH access from the undercloud to the overcloud for the
tripleo-adminuser. Theconfig-downloadprocess uses thetripleo-adminuser to perform the Ansible-based configuration:openstack overcloud admin authorize
$ openstack overcloud admin authorizeCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Perform any manual pre-configuration tasks on nodes. If you use Ansible for configuration, use the
tripleo-adminuser to access the nodes. Run the deployment command with the
--config-download-onlyoption. Include any environment files required for your overcloud:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Wait until the configuration process completes.
During the configuration stage, director generates the config-download files in a ~/config-download/overcloud working directory. After the deployment process finishes, view the Ansible playbooks in the working directory to see the tasks director executed to configure the overcloud.
9.2.8. Running config-download with the ansible-playbook-command.sh script Copiar o linkLink copiado para a área de transferência!
When you deploy the overcloud, either with the standard method or a separate provisioning and configuration process, director generates a working directory in ~/config-download/overcloud. This directory contains the playbooks and scripts necessary to run the configuration process again.
For information about config-download tasks and tags, see config-download tasks and tags.
Prerequisites
An overcloud deployed with the one of the following methods:
- Standard method that combines provisioning and configuration process.
- Separate provisioning and configuration processes.
Procedure
-
Log in to the undercloud host as the
stackuser. Run the
ansible-playbook-command.shscript.You can pass additional Ansible arguments to this script, which are then passed unchanged to the
ansible-playbookcommand. This makes it possible to take advantage of Ansible features, such as check mode (--check), limiting hosts (--limit), or overriding variables (-e). For example:./ansible-playbook-command.sh --limit Controller
$ ./ansible-playbook-command.sh --limit ControllerCopy to Clipboard Copied! Toggle word wrap Toggle overflow WarningWhen
--limitis used to deploy at scale, only hosts included in the execution are added to the SSHknown_hostsfile across the nodes. Therefore, some operations, such as live migration, may not work across nodes that are not in theknown_hostsfile.NoteTo ensure that the
/etc/hostsfile, on all nodes, is up-to-date, run the following command as thestackuser:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Wait until the configuration process completes.
9.2.9. Running config-download with manually created playbooks Copiar o linkLink copiado para a área de transferência!
You can create your own config-download files outside of the standard workflow by provisioning the nodes and applying the Ansible configuration separately.
Prerequisites
- A successful undercloud installation
- Overcloud nodes ready for deployment
- Heat environment files that are relevant to your specific overcloud customization
Procedure
-
Log in to the undercloud host as the
stackuser. Source the
stackrcundercloud credentials file:source ~/stackrc
$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Provision the overcloud nodes:
openstack overcloud node provision \ --stack <stackname> \ --output <deployment_file> \ /home/stack/templates/overcloud-baremetal-deploy.yaml
$ openstack overcloud node provision \ --stack <stackname> \ --output <deployment_file> \ /home/stack/templates/overcloud-baremetal-deploy.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<stackname>with the name of the stack for which the nodes are provisioned. The default value isovercloud. -
Replace
<deployment_file>with the name of the heat environment file to generate for inclusion in the deployment command, for example/home/stack/templates/overcloud-nodes-deployed.yaml.
-
Replace
Run the deployment command with the
--stack-onlyoption. Include any environment files required for your overcloud:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Navigate to the directory that contains your
config-downloadfiles:cd ~/overcloud-deploy/<stackname>/config-download/<stackname>
$ cd ~/overcloud-deploy/<stackname>/config-download/<stackname>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
~/overcloud-deploy/<stackname>/config-download/<stackname>files to add a custom configuration. To execute the deployment playbook, run theansible-playbookcommand:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteWhen you run the
config-download/overcloudplaybooks against the overcloud, you might receive a message regarding the SSH fingerprint for each host. To avoid these messages, include--ssh-common-args="-o StrictHostKeyChecking=no"in youransible-playbookcommand:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Wait until the configuration process completes.
9.2.10. Limitations of config-download Copiar o linkLink copiado para a área de transferência!
The config-download feature has some limitations:
-
When you use ansible-playbook CLI arguments such as
--tags,--skip-tags, or--start-at-task, do not run or apply deployment configuration out of order. These CLI arguments are a convenient way to rerun previously failed tasks or to iterate over an initial deployment. However, to guarantee a consistent deployment, you must run all tasks fromdeploy_steps_ansible-playbook.yamlin order. You can not use the
--start-at-taskarguments for certain tasks that use a variable in the task name. For example, the--start-at-taskarguments does not work for the following Ansible task:- name: Run puppet host configuration for step {{ step }}- name: Run puppet host configuration for step {{ step }}Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
If your overcloud deployment includes a director-deployed Ceph Storage cluster, you cannot skip
step1tasks when you use the--checkoption unless you also skipexternal_deploy_stepstasks. -
You can set the number of parallel Ansible tasks with the
--forksoption. However, the performance ofconfig-downloadoperations degrades after 25 parallel tasks. For this reason, do not exceed 25 with the--forksoption.
9.2.11. config-download top level files Copiar o linkLink copiado para a área de transferência!
The following file are important top level files within a config-download working directory.
Ansible configuration and execution
The following files are specific to configuring and executing Ansible within the config-download working directory.
- ansible.cfg
-
Configuration file used when running
ansible-playbook. - ansible.log
-
Log file from the last run of
ansible-playbook. - ansible-errors.json
- JSON structured file that contains any deployment errors.
- ansible-playbook-command.sh
-
Executable script to rerun the
ansible-playbookcommand from the last deployment operation. - ssh_private_key
- Private SSH key that Ansible uses to access the overcloud nodes.
- tripleo-ansible-inventory.yaml
- Ansible inventory file that contains hosts and variables for all the overcloud nodes.
- overcloud-config.tar.gz
- Archive of the working directory.
Playbooks
The following files are playbooks within the config-download working directory.
- deploy_steps_ansible-playbook.yaml
- Main deployment steps. This playbook performs the main configuration operations for your overcloud.
- pre_upgrade_rolling_steps_playbook.yaml
- Pre upgrade steps for major upgrade
- upgrade_steps_playbook.yaml
- Major upgrade steps.
- post_upgrade_steps_playbook.yaml
- Post upgrade steps for major upgrade.
- update_steps_playbook.yaml
- Minor update steps.
- fast_forward_upgrade_playbook.yaml
- Fast forward upgrade tasks. Use this playbook only when you want to upgrade from one long-life version of Red Hat OpenStack Platform to the next.
9.2.12. config-download tasks and tags Copiar o linkLink copiado para a área de transferência!
The config-download working directory, for example, ~/overcloud-deploy/overcloud/config-download/overcloud/, contains a playbook called deploy_steps_ansible-playbook.yaml. To view this playbook, run the following command:
less deploy_steps_ansible-playbook.yaml
$ less deploy_steps_ansible-playbook.yaml
The playbook uses various task files contained in the working directory. Some of the playbook task files are common to all Red Hat OpenStack Platform (RHOSP) roles and some are for specific RHOSP roles and servers.
The config-download working directory also contains sub-directories that correspond to each role that you define in your overcloud roles_data file. Each RHOSP role directory contains sub-directories for individual servers of that role type. The directories use the composable role hostname format, for example Controller/overcloud-controller-0.
The Ansible tasks in deploy_steps_playbook.yaml are tagged. To see the full list of tags, use the --list-tags option with the ansible-playbook command.
ansible-playbook -i ~/tripleo-deploy/<stackname>/tripleo-ansible-inventory.yaml \ --list-tags ~/tripleo-deploy/<stackname>/deploy_steps_ansible-playbook.yaml
$ ansible-playbook -i ~/tripleo-deploy/<stackname>/tripleo-ansible-inventory.yaml \
--list-tags ~/tripleo-deploy/<stackname>/deploy_steps_ansible-playbook.yaml
You can apply tags by using the --tags, --skip-tags, or --start-at-task options with the ansible-playbook-command.sh script:
When you run the config-download playbooks against the overcloud, you might receive a message regarding the SSH fingerprint for each host. To avoid these messages, include --ssh-common-args="-o StrictHostKeyChecking=no" when you run the ansible-playbook-command.sh script:
./ansible-playbook-command.sh --tags overcloud --ssh-common-args="-o StrictHostKeyChecking=no"
$ ./ansible-playbook-command.sh --tags overcloud --ssh-common-args="-o StrictHostKeyChecking=no"
The following list contains information about the default tags for deploy_steps_ansible-playbook.yaml:
- facts
- Fact gathering operations.
- common_roles
- Ansible roles common to all nodes.
- overcloud
- All plays for overcloud deployment.
- pre_deploy_steps
-
Deployments that happen before the
deploy_stepsoperations. - host_prep_steps
- Host preparation steps.
- deploy_steps
- Deployment steps.
- post_deploy_steps
-
Steps that happen after the
deploy_stepsoperations. - external
- All external deployment tasks.
- external_deploy_steps
- External deployment tasks that run on the undercloud only.
9.2.13. config-download deployment steps Copiar o linkLink copiado para a área de transferência!
The deploy_steps_ansible-playbook.yaml playbook configures the overcloud. This playbook applies all software configuration that is necessary to deploy a full overcloud based on the overcloud deployment plan.
This section contains a summary of the different Ansible plays used within this playbook. The play names in this section are the same names that are used within the playbook and that are displayed in the ansible-playbook output. This section also contains information about the Ansible tags that are set on each play.
- Gather facts from undercloud
Fact gathering for the undercloud node.
Tags:
facts- Gather facts from overcloud
Fact gathering for the overcloud nodes.
Tags:
facts- Load global variables
Loads all variables from
global_vars.yaml.Tags:
always- Common roles for TripleO servers
Applies common Ansible roles to all overcloud nodes, including tripleo-bootstrap for installing bootstrap packages, and tripleo-ssh-known-hosts for configuring ssh known hosts.
Tags:
common_roles- Overcloud deploy step tasks for step 0
Applies tasks from the deploy_steps_tasks template interface.
Tags:
overcloud,deploy_steps- Server deployments
Applies server-specific heat deployments for configuration such as networking and hieradata. Includes NetworkDeployment, <Role>Deployment, <Role>AllNodesDeployment, etc.
Tags:
overcloud,pre_deploy_steps- Host prep steps
Applies tasks from the host_prep_steps template interface.
Tags:
overcloud,host_prep_steps- External deployment step [1,2,3,4,5]
Applies tasks from the external_deploy_steps_tasks template interface. Ansible runs these tasks only against the undercloud node.
Tags:
external,external_deploy_steps- Overcloud deploy step tasks for [1,2,3,4,5]
Applies tasks from the deploy_steps_tasks template interface.
Tags:
overcloud,deploy_steps- Overcloud common deploy step tasks [1,2,3,4,5]
Applies the common tasks performed at each step, including puppet host configuration,
container-puppet.py, andtripleo-container-manage(container configuration and management).Tags:
overcloud,deploy_steps- Server Post Deployments
Applies server specific heat deployments for configuration performed after the 5-step deployment process.
Tags:
overcloud,post_deploy_steps- External deployment Post Deploy tasks
Applies tasks from the external_post_deploy_steps_tasks template interface. Ansible runs these tasks only against the undercloud node.
Tags:
external,external_deploy_steps
9.3. Managing containers with Ansible Copiar o linkLink copiado para a área de transferência!
Red Hat OpenStack Platform 17.1 uses the tripleo_container_manage Ansible role to perform management operations on containers. You can also write custom playbooks to perform specific container management operations:
-
Collect the container configuration data that heat generates. The
tripleo_container_managerole uses this data to orchestrate container deployment. - Start containers.
- Stop containers.
- Update containers.
- Delete containers.
- Run a container with a specific configuration.
Although director performs container management automatically, you might want to customize a container configuration, or apply a hotfix to a container without redeploying the overcloud.
This role supports only Podman container management.
9.3.1. tripleo-container-manage role defaults and variables Copiar o linkLink copiado para a área de transferência!
The following excerpt shows the defaults and variables for the tripleo_container_manage Ansible role.
9.3.2. tripleo-container-manage molecule scenarios Copiar o linkLink copiado para a área de transferência!
Molecule is used to test the tripleo_container_manage role. The following shows a molecule default inventory:
Usage
Red Hat OpenStack 17.1 supports only Podman in this role. Docker support is on the roadmap.
The Molecule Ansible role performs the following tasks:
-
Collect container configuration data, generated by the TripleO Heat Templates. This data is used as a source of truth. If a container is already managed by
Molecule, no matter its present state, the configuration data will reconfigure the container as needed. -
Manage
systemdshutdown files. It creates theTripleO Container systemdservice, required for service ordering when shutting down or starting a node. It also manages thenetns-placeholderservice. Delete containers that are nonger needed or that require reconfiguration. It uses a custom filter, named
needs_delete()which has a set of rules to determine if the container needs to be deleted.-
A container will not be deleted if, the container is not managed by
tripleo_ansibleor the containerconfig_iddoes not match the input ID. -
A container will be deleted, if the container has no
config_dataor the container hasconfig_datawhich does not match data in input. Note that when a container is removed, the role also disables and removes thesystemdservices and healtchecks.
-
A container will not be deleted if, the container is not managed by
Create containers in a specific order defined by
start_ordercontainer config, where the default is 0.-
If the container is an
exec, a dedicated playbook forexecsis run, usingasyncso multipleexecscan be run at the same time. -
Otherwise, the
podman_containeris used, in async, to create the containers. If the container has arestart policy,systemdservice is configured. If the container has a healthcheck script,systemd healthcheckservice is configured.
-
If the container is an
tripleo_container_manage_concurrency parameter is set to 1 by default, and putting a value higher than 2 can expose issues with Podman locks.
Example of a playbook:
9.3.3. tripleo_container_manage role variables Copiar o linkLink copiado para a área de transferência!
The tripleo_container_manage Ansible role contains the following variables:
| Name | Default value | Description |
|---|---|---|
| tripleo_container_manage_check_puppet_config | false |
Use this variable if you want Ansible to check Puppet container configurations. Ansible can identify updated container configuration using the configuration hash. If a container has a new configuration from Puppet, set this variable to |
| tripleo_container_manage_cli | podman |
Use this variable to set the command line interface that you want to use to manage containers. The |
| tripleo_container_manage_concurrency | 1 | Use this variable to set the number of containers that you want to manage concurrently. |
| tripleo_container_manage_config | /var/lib/tripleo-config/ | Use this variable to set the path to the container configuration directory. |
| tripleo_container_manage_config_id | tripleo |
Use this variable to set the ID of a specific configuration step. For example, set this value to |
| tripleo_container_manage_config_patterns | *.json | Use this variable to set the bash regular expression that identifies configuration files in the container configuration directory. |
| tripleo_container_manage_debug | false |
Use this variable to enable or disable debug mode. Run the |
| tripleo_container_manage_healthcheck_disable | false | Use this variable to enable or disable healthchecks. |
| tripleo_container_manage_log_path | /var/log/containers/stdouts | Use this variable to set the stdout log path for containers. |
| tripleo_container_manage_systemd_order | false | Use this variable to enable or disable systemd shutdown ordering with Ansible. |
| tripleo_container_manage_systemd_teardown | true | Use this variable to trigger the cleanup of obsolete containers. |
| tripleo_container_manage_config_overrides | {} | Use this variable to override any container configuration. This variable takes a dictionary of values where each key is the container name and the parameters that you want to override, for example, the container image or user. This variable does not write custom overrides to the JSON container configuration files and any new container deployments, updates, or upgrades revert to the content of the JSON configuration file. |
| tripleo_container_manage_valid_exit_code | [] |
Use this variable to check if a container returns an exit code. This value must be a list, for example, |
9.3.4. tripleo-container-manage healthchecks Copiar o linkLink copiado para a área de transferência!
Until Red Hat OpenStack 17.1, container healthcheck was implemented by a systemd timer which would run podman exec to determine if a given container was healthy. Now, it uses the native healthcheck interface in Podman which is easier to integrate and consume.
To check if a container (for example, keystone) is healthy, run the following command:
sudo podman healthcheck run keystone
$ sudo podman healthcheck run keystone
The return code should be 0 and “healthy”.
9.3.5. tripleo-container-manage debug Copiar o linkLink copiado para a área de transferência!
The tripleo_container_manage Ansible role allows you to perform specific actions on a given container. This can be used to:
- Run a container with a specific one-off configuration.
- Output the container commands to manage containers lifecycle.
- Output the changes made on containers by Ansible.
To manage a single container, you need to know two things:
- At which step during the overcloud deployment was the container deployed.
- The name of the generated JSON file containing the container configuration.
The following is an example of a playbook to manage HAproxy container at step 1 which overrides the image setting:
If Ansible is run in check mode, no container is removed or created, however at the end of the playbook run a list of commands is displayed to show the possible outcome of the playbook. This is useful for debugging purposes.
ansible-playbook haproxy.yaml --check
$ ansible-playbook haproxy.yaml --check
Adding the diff mode will show the changes that would have been made on containers by Ansible.
ansible-playbook haproxy.yaml --check --diff
$ ansible-playbook haproxy.yaml --check --diff
The tripleo_container_manage_clean_orphans parameter is optional. It can be set to false meaning orphaned containers, with a specific config_id, will not be removed. It can be used to manage a single container without impacting other running containers with same config_id.
The tripleo_container_manage_config_overrides parameter is optional and can be used to override a specific container attribute, for example the image or the container user. The parameter creates dictionary with container name and the parameters to override. These parameters have to exist and they define the container configuration in TripleO Heat Templates.
Note the dictionary does not update the overrides in the JSON file so if an update or upgrade is executed, the container will be re-configured with the configuration in the JSON file.