In this chapter, you can find the information on how to configure the openstack-ansible dynamic inventory to your needs.
Common OpenStack services and their configuration are defined by
OpenStack-Ansible in the
/etc/openstack_deploy/openstack_user_config.yml
settings file.
Additional services should be defined with a YAML file in
/etc/openstack_deploy/conf.d
, in order to manage file size.
The /etc/openstack_deploy/env.d
directory sources all YAML files into the
deployed environment, allowing a deployer to define additional group mappings.
This directory is used to extend the environment skeleton, or modify the
defaults defined in the inventory/env.d
directory.
To understand how the dynamic inventory works, see Understanding the inventory.
Warning
Never edit or delete the files
/etc/openstack_deploy/openstack_inventory.json
or
/etc/openstack_deploy/openstack_hostnames_ips.yml
. This can
lead to file corruptions, and problems with the inventory: hosts
and container could disappear and new ones would appear,
breaking your existing deployment.
When adding groups, keep the following in mind:
However, groups cannot contain child groups and hosts.
When the dynamic inventory script creates a container name, the host on
which the container resides is added to the lxc_hosts
inventory group.
Using this name for a group in the configuration will result in a runtime error.
To deploy a component directly on the host instead of within a container, set
the is_metal
property to true
for the container group in the
container_skel
section in the appropriate file.
The use of container_vars
and mapping from container groups to host groups
is the same for a service deployed directly onto the host.
Note
The cinder-volume
component is deployed directly on the host by
default. See the env.d/cinder.yml
file for this example.
For example, to run Galera directly on dedicated hosts, you would perform the following steps:
Modify the container_skel
section of the env.d/galera.yml
file.
For example:
container_skel:
galera_container:
belongs_to:
- db_containers
contains:
- galera
properties:
is_metal: true
Note
To deploy within containers on these dedicated hosts, omit the
is_metal: true
property.
Assign the db_containers
container group (from the preceding step) to a
host group by providing a physical_skel
section for the host group
in a new or existing file, such as env.d/galera.yml
.
For example:
physical_skel:
db_containers:
belongs_to:
- all_containers
db_hosts:
belongs_to:
- hosts
Define the host group (db_hosts
) in a conf.d/
file (such as
galera.yml
). For example:
db_hosts:
db-host1:
ip: 172.39.123.11
db-host2:
ip: 172.39.123.12
db-host3:
ip: 172.39.123.13
Note
Each of the custom group names in this example (db_containers
and db_hosts
) are arbitrary. Choose your own group names,
but ensure the references are consistent among all relevant files.
When OpenStack-Ansible generates its dynamic inventory, the affinity setting determines how many containers of a similar type are deployed on a single physical host.
Using shared-infra_hosts
as an example, consider this
openstack_user_config.yml
configuration:
shared-infra_hosts:
infra1:
ip: 172.29.236.101
infra2:
ip: 172.29.236.102
infra3:
ip: 172.29.236.103
Three hosts are assigned to the shared-infra_hosts group, OpenStack-Ansible ensures that each host runs a single database container, a single Memcached container, and a single RabbitMQ container. Each host has an affinity of 1 by default, which means that each host runs one of each container type.
If you are deploying a stand-alone Object Storage (swift) environment,
you can skip the deployment of RabbitMQ. If you use this configuration,
your openstack_user_config.yml
file would look as follows:
shared-infra_hosts:
infra1:
affinity:
rabbit_mq_container: 0
ip: 172.29.236.101
infra2:
affinity:
rabbit_mq_container: 0
ip: 172.29.236.102
infra3:
affinity:
rabbit_mq_container: 0
ip: 172.29.236.103
This configuration deploys a Memcached container and a database container on each host, but no RabbitMQ containers.
To omit a component from a deployment, you can use one of several options:
physical_skel
link between the container group and
the host group by deleting the related file located in the env.d/
directory.is_metal
property, a container is created for this component.is_metal
property, a container is created for this component.Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.