Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 10. Configuring the overcloud with Ansible
This feature is available in this release as a Technology Preview, and therefore is not fully supported by Red Hat. It should only be used for testing, and should not be deployed in a production environment. For more information about Technology Preview features, see Scope of Coverage Details.
It is possible to use Ansible as the main method to apply the overcloud configuration. This chapter provides steps on enabling this feature on your overcloud.
Although director automatically generates the Ansible playbooks, it is a good idea to familiarize yourself with Ansible syntax. See https://docs.ansible.com/ for more information about how to use Ansible.
Ansible also uses the concept of roles, which are different to OpenStack Platform director roles.
This configuration method does not support deploying Ceph Storage clusters on any nodes.
10.1. Ansible-based overcloud configuration (config-download) Link kopierenLink in die Zwischenablage kopiert!
				The config-download feature:
			
- Enables application of the overcloud configuration with Ansible instead of Heat.
 - 
						Replaces the communication and transport of the configuration deployment data between Heat and the Heat agent (
os-collect-config) on the overcloud nodes 
				Heat retains the standard functionality with or without config-download enabled:
			
- The director passes environment files and parameters to Heat.
 - The director uses Heat to create the stack and all descendant resources.
 - Heat still creates any OpenStack service resources, including bare metal node and network creation.
 
				Although Heat creates all deployment data from SoftwareDeployment resources to perform the overcloud installation and configuration, it does not apply any of the configuration. Instead, Heat only provides the data through its API. Once the stack is created, a Mistral workflow queries the Heat API for the deployment data and applies the configuration by running ansible-playbook with an Ansible inventory file and a generated set of playbooks.
			
10.2. Switching the overcloud configuration method to config-download Link kopierenLink in die Zwischenablage kopiert!
				The following procedure switches the overcloud configuration method from OpenStack Orchestration (heat) to an Ansible-based config-download method. In this situation, the undercloud acts as the Ansible control node i.e. the node running ansible-playbook. The terms control node and undercloud refer to the same node where the undercloud installation has been performed.
			
Procedure
Source the
stackrcfile.source ~/stackrc
$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the overcloud deployment command and include the
--config-downloadoption and the environment file to disable heat-based configuration:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note the use of the following options:
- 
								
--config-downloadenables the additional Mistral workflow, which applies the configuration withansible-playbookinstead of Heat. - 
								
-e /usr/share/openstack-tripleo-heat-templates/environments/config-download-environment.yamlis a required environment file that maps the Heat software deployment configuration resources to their Ansible-based equivalents. This provides the configuration data through the Heat API without Heat applying configuration. - 
								
--overcloud-ssh-userand--overcloud-ssh-keyare used to SSH into each overcloud node, create an initialtripleo-adminuser, and inject an SSH key into/home/tripleo-admin/.ssh/authorized_keys. To inject the SSH key, the user specifies credentials for the initial SSH connection with--overcloud-ssh-user(defaults toheat-admin) and--overcloud-ssh-key(defaults to~/.ssh/id_rsa). To limit exposure to the private key specified with--overcloud-ssh-key, the director never passes this key to any API service, such as Heat or Mistral, and only the director’sopenstack overcloud deploycommand uses this key to enable access for thetripleo-adminuser. 
When running this command, make sure you also include any other files relevant to your overcloud. For example:
- 
								Custom configuration environment files with 
-e - 
								A custom roles (
roles_data) file with--roles-file - 
								A composable network (
network_data) file with--networks-file 
- 
								
 The overcloud deployment command performs the standard stack operations. However, when the overcloud stack reaches the configuration stage, the stack switches to the
config-downloadmethod for configuring the overcloud:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Wait until the overcloud configuration completes.
After the Ansible configuration of the overcloud completes, the director provides a report of the successful and failed tasks and the access URLs for the overcloud:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 
				If using pre-provisioned nodes, you need to perform an additional step to ensure a successful deployment with config-download.
			
10.3. Enabling config-download with pre-provisioned nodes Link kopierenLink in die Zwischenablage kopiert!
				When using config-download with pre-provisioned nodes, you need to map Heat-based hostnames to their actual hostnames so that ansible-playbook can reach a resolvable host. Use the HostnameMap to map these values.
			
Procedure
Create an environment file (e.g.
hostname-map.yaml) and include theHostnameMapparameter and the hostname mappings. Use the following syntax:parameter_defaults: HostnameMap: [HEAT HOSTNAME]: [ACTUAL HOSTNAME] [HEAT HOSTNAME]: [ACTUAL HOSTNAME]parameter_defaults: HostnameMap: [HEAT HOSTNAME]: [ACTUAL HOSTNAME] [HEAT HOSTNAME]: [ACTUAL HOSTNAME]Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
[HEAT HOSTNAME]usually follows the following convention:[STACK NAME]-[ROLE]-[INDEX]. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 
						Save the contents of 
hostname-map.yaml. When running a
config-downloaddeployment, include the environment file with the-eoption. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 
10.4. Enabling access to config-download working directories Link kopierenLink in die Zwischenablage kopiert!
				Mistral performs the execution of the Ansible playbooks for the config-download feature. Mistral saves the playbooks, configuration files, and logs in a working directory. You can find these working directories in /var/lib/mistral/ and are named using the UUID of the Mistral workflow execution.
			
				Before accessing these working directories, you need to set the appropriate permissions for your stack user.
			
Procedure
The
mistralgroup can read all files under/var/lib/mistral. Grant the interactivestackuser on the undercloud read-only access to these files:sudo usermod -a -G mistral stack
$ sudo usermod -a -G mistral stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow Refresh the
stackuser’s permissions with the following command:exec su -l stack
[stack@director ~]$ exec su -l stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow The command prompts you to log in again. Enter the
stackuser’s password.Test read access to the
/var/lib/mistraldirectory:ls /var/lib/mistral/
$ ls /var/lib/mistral/Copy to Clipboard Copied! Toggle word wrap Toggle overflow 
10.5. Checking config-download logs and working directory Link kopierenLink in die Zwischenablage kopiert!
				During the config-download process, Ansible creates a log file on the undercloud at /var/lib/mistral/<execution uuid>/ansible.log. The <execution uuid> is a UUID that corresponds to the Mistral execution that ran ansible-playbook.
			
Procedure
List all executions using the
openstack workflow execution listcommand and find the workflow ID of the chosen Mistral execution that executedconfig-download:openstack workflow execution list less /var/lib/mistral/<execution uuid>/ansible.log
$ openstack workflow execution list $ less /var/lib/mistral/<execution uuid>/ansible.logCopy to Clipboard Copied! Toggle word wrap Toggle overflow <execution uuid>is the UUID of the Mistral execution that ranansible-playbook.Alternatively, look for the most recently modified directory under
/var/lib/mistralto quickly find the log for the most recent deployment:less /var/lib/mistral/$(ls -t /var/lib/mistral | head -1)/ansible.log
$ less /var/lib/mistral/$(ls -t /var/lib/mistral | head -1)/ansible.logCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
10.6. Running config-download manually Link kopierenLink in die Zwischenablage kopiert!
				Each working directory in /var/lib/mistral/ contains the necessary playbooks and scripts to interact with ansible-playbook directly. This procedure shows how to interact with these files.
			
Procedure
Change to the directory of the Ansible playbook of your choice:
cd /var/lib/mistral/<execution uuid>/
$ cd /var/lib/mistral/<execution uuid>/Copy to Clipboard Copied! Toggle word wrap Toggle overflow <execution uuid>is the UUID of the Mistral execution that ranansible-playbook.Once in the mistral working directory, run
ansible-playbook-command.shto reproduce the deployment:./ansible-playbook-command.sh
$ ./ansible-playbook-command.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow You can pass additional Ansible arguments to this script, which in turn are passed unchanged to the
ansible-playbookcommand. This makes it is possible to take further 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 The working directory contains a playbook called
deploy_steps_playbook.yaml, which runs the overcloud configuration. To view this playbook:less deploy_steps_playbook.yaml
$ less deploy_steps_playbook.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow The playbook uses various task files contained with the working directory. Some task files are common to all OpenStack Platform roles and some are specific to certain OpenStack Platform roles and servers.
The working directory also contains sub-directories that correspond to each role defined in your overcloud’s
roles_datafile. For example:ls Controller/
$ ls Controller/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Each OpenStack Platform role directory also contains sub-directories for individual servers of that role type. The directories use the composable role hostname format. For example:
ls Controller/overcloud-controller-0
$ ls Controller/overcloud-controller-0Copy to Clipboard Copied! Toggle word wrap Toggle overflow The Ansible tasks are tagged. To see the full list of tags use the CLI argument
--list-tagsforansible-playbook:ansible-playbook -i tripleo-ansible-inventory.yaml --list-tags deploy_steps_playbook.yaml
$ ansible-playbook -i tripleo-ansible-inventory.yaml --list-tags deploy_steps_playbook.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Then apply tagged configuration using the
--tags,--skip-tags, or--start-at-taskwith theansible-playbook-command.shscript. For example:./ansible-playbook-command.sh --tags overcloud
$ ./ansible-playbook-command.sh --tags overcloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
					When using 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 iterating over an initial deployment. However, to guarantee a consistent deployment, you must run all tasks from deploy_steps_playbook.yaml in order.
				
10.7. Disabling config-download Link kopierenLink in die Zwischenablage kopiert!
				To switch back to the standard Heat-based configuration method, remove the relevant option and environment file the next time you run openstack overcloud deploy.
			
Procedure
Source the
stackrcfile.source ~/stackrc
$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the overcloud deployment command but do not include the
--config-downloadoption or the 'config-download-environment.yaml` environment file:openstack overcloud deploy --templates \ [OTHER OPTIONS]$ openstack overcloud deploy --templates \ [OTHER OPTIONS]Copy to Clipboard Copied! Toggle word wrap Toggle overflow When running this command, make sure you also include any other files relevant to your overcloud. For example:
- 
								Custom configuration environment files with 
-e - 
								A custom roles (
roles_data) file with--roles-file - 
								A composable network (
network_data) file with--networks-file 
- 
								Custom configuration environment files with 
 - The overcloud deployment command performs the standard stack operations, including configuration with Heat.
 
10.8. Next Steps Link kopierenLink in die Zwischenablage kopiert!
You can now continue your regular overcloud operations.