2016-08-31 12:31:43 +01:00
|
|
|
|
==================================================
|
|
|
|
|
Appendix C: Customizing host and service layouts
|
|
|
|
|
==================================================
|
2016-05-27 15:28:03 -07:00
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
The default layout of containers and services in OpenStack-Ansible (OSA) is
|
|
|
|
|
determined by the ``/etc/openstack_deploy/openstack_user_config.yml`` file and
|
|
|
|
|
the contents of both the ``/etc/openstack_deploy/conf.d/`` and
|
|
|
|
|
``/etc/openstack_deploy/env.d/`` directories. You use these sources to define
|
|
|
|
|
the *group* mappings that the playbooks use to target hosts and containers for
|
|
|
|
|
roles used in the deploy.
|
|
|
|
|
|
|
|
|
|
* You define host groups, which gather the target hosts into *inventory
|
|
|
|
|
groups*, through the ``/etc/openstack_deploy/openstack_user_config.yml``
|
|
|
|
|
file and the contents of the ``/etc/openstack_deploy/conf.d/`` directory.
|
|
|
|
|
|
|
|
|
|
* You define *container groups*, which can map from the service components
|
|
|
|
|
to be deployed up to host groups, through files in the
|
|
|
|
|
``/etc/openstack_deploy/env.d/`` directory.
|
|
|
|
|
|
|
|
|
|
To customize the layout of the components for your deployment, modify the
|
|
|
|
|
host groups and container groups appropriately before running the installation
|
|
|
|
|
playbooks.
|
2016-05-27 15:28:03 -07:00
|
|
|
|
|
|
|
|
|
Understanding host groups
|
2016-10-05 13:34:43 -05:00
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
2016-08-31 12:31:43 +01:00
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
As part of the initial configuration, each target host appears either in the
|
2016-05-27 15:28:03 -07:00
|
|
|
|
``/etc/openstack_deploy/openstack_user_config.yml`` file or in files within
|
2016-10-05 13:34:43 -05:00
|
|
|
|
the ``/etc/openstack_deploy/conf.d/`` directory. The format used for files in
|
|
|
|
|
the ``conf.d/`` directory is identical to the syntax used in the
|
|
|
|
|
``openstack_user_config.yml`` file.
|
|
|
|
|
|
|
|
|
|
In these files, the target hosts are listed under one or more
|
2016-08-31 12:31:43 +01:00
|
|
|
|
headings, such as ``shared-infra_hosts`` or ``storage_hosts``, which serve as
|
2016-10-05 13:34:43 -05:00
|
|
|
|
Ansible group mappings. These groups map to the physical
|
2016-05-27 15:28:03 -07:00
|
|
|
|
hosts.
|
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
The ``haproxy.yml.example`` file in the ``conf.d/`` directory provides
|
2016-05-27 15:28:03 -07:00
|
|
|
|
a simple example of defining a host group (``haproxy_hosts``) with two hosts
|
|
|
|
|
(``infra1`` and ``infra2``).
|
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
The ``swift.yml.example`` file provides a more complex example. Here, host
|
|
|
|
|
variables for a target host are specified by using the ``container_vars`` key.
|
2016-05-27 15:28:03 -07:00
|
|
|
|
OpenStack-Ansible applies all entries under this key as host-specific
|
|
|
|
|
variables to any component containers on the specific host.
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
To manage file size, we recommend that you define new inventory groups,
|
|
|
|
|
particularly for new services, by using a new file in the
|
|
|
|
|
``conf.d/`` directory.
|
2016-05-27 15:28:03 -07:00
|
|
|
|
|
|
|
|
|
Understanding container groups
|
2016-10-05 13:34:43 -05:00
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2016-08-31 12:31:43 +01:00
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
Additional group mappings are located within files in the
|
|
|
|
|
``/etc/openstack_deploy/env.d/`` directory. These groups are treated as
|
2016-05-27 15:28:03 -07:00
|
|
|
|
virtual mappings from the host groups (described above) onto the container
|
2016-10-05 13:34:43 -05:00
|
|
|
|
groups, that define where each service deploys. By reviewing files within the
|
2016-05-27 15:28:03 -07:00
|
|
|
|
``env.d/`` directory, you can begin to see the nesting of groups represented
|
|
|
|
|
in the default layout.
|
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
For example, the ``shared-infra.yml`` file defines a container group,
|
|
|
|
|
``shared- infra_containers``, as a subset of the all_containers inventory
|
|
|
|
|
group. The ``shared- infra_containers`` container group is mapped to the
|
|
|
|
|
``shared-infra_hosts`` host group. All of the service components in the
|
|
|
|
|
``shared-infra_containers`` container group are deployed to each target host
|
|
|
|
|
in the ``shared-infra_hosts host`` group.
|
2016-05-27 15:28:03 -07:00
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
Within a ``physical_skel`` section, the OpenStack-Ansible dynamic inventory
|
2016-05-27 15:28:03 -07:00
|
|
|
|
expects to find a pair of keys. The first key maps to items in the
|
2016-10-05 13:34:43 -05:00
|
|
|
|
``container_skel`` section, and the second key maps to the target host groups
|
|
|
|
|
(described above) that are responsible for hosting the service component.
|
2016-05-27 15:28:03 -07:00
|
|
|
|
|
2016-10-07 11:37:08 +01:00
|
|
|
|
To continue the example, the ``memcache.yml`` file defines the
|
2016-10-05 13:34:43 -05:00
|
|
|
|
``memcache_container`` container group. This group is a subset of the
|
|
|
|
|
``shared-infra_containers`` group, which is itself a subset of
|
2016-05-27 15:28:03 -07:00
|
|
|
|
the ``all_containers`` inventory group.
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
The ``all_containers`` group is automatically defined by OpenStack-Ansible.
|
|
|
|
|
Any service component managed by OpenStack-Ansible maps to a subset of the
|
2016-10-05 13:34:43 -05:00
|
|
|
|
``all_containers`` inventory group, directly or indirectly through
|
2016-05-27 15:28:03 -07:00
|
|
|
|
another intermediate container group.
|
|
|
|
|
|
|
|
|
|
The default layout does not rely exclusively on groups being subsets of other
|
|
|
|
|
groups. The ``memcache`` component group is part of the ``memcache_container``
|
|
|
|
|
group, as well as the ``memcache_all`` group and also contains a ``memcached``
|
|
|
|
|
component group. If you review the ``playbooks/memcached-install.yml``
|
2016-08-31 12:31:43 +01:00
|
|
|
|
playbook, you see that the playbook applies to hosts in the ``memcached``
|
2016-10-05 13:34:43 -05:00
|
|
|
|
group. Other services might have more complex deployment needs. They define and
|
2016-05-27 15:28:03 -07:00
|
|
|
|
consume inventory container groups differently. Mapping components to several
|
|
|
|
|
groups in this way allows flexible targeting of roles and tasks.
|
|
|
|
|
|
|
|
|
|
Customizing existing components
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Deploying directly on hosts
|
|
|
|
|
---------------------------
|
|
|
|
|
|
2016-08-31 12:31:43 +01:00
|
|
|
|
To deploy a component directly on the host instead of within a container, set
|
2016-10-05 13:34:43 -05:00
|
|
|
|
the ``is_metal`` property to ``true`` for the container group in the
|
|
|
|
|
``container_skel`` section in the appropriate file.
|
2016-05-27 15:28:03 -07:00
|
|
|
|
|
|
|
|
|
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::
|
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
The ``cinder-volume`` component is deployed directly on the host by
|
2016-08-31 12:31:43 +01:00
|
|
|
|
default. See the ``env.d/cinder.yml`` file for this example.
|
2016-05-27 15:28:03 -07:00
|
|
|
|
|
|
|
|
|
Omit a service or component from the deployment
|
|
|
|
|
-----------------------------------------------
|
|
|
|
|
|
2016-10-05 13:34:43 -05:00
|
|
|
|
To omit a component from a deployment, you can use one of several options:
|
Use in-tree env.d files, provide override support
In past versions, upgrading OpenStack-Ansible lead to contention between
the code base and deployer customizations when env.d files were changed.
Deployers were encouraged to make their customizations, while the
project needed to sometimes adjust architecture. Detecting these
conflicts in an automated way was difficult, since the files were simple
dictionaries and lists, leaving no metadata to describe intent for the
changes.
This change modifies the dynamic inventory system to first use the
in-tree env.d directory as the base environment, then reads in files
from the /etc/openstack_deploy/env.d directory and updates existing keys
with the new values. In this way, the OSA project can modify the
environment and deployers can customize the environment without directly
manipulating the same files.
As part of this change, the env.d directory was moved in to the
playbooks/inventory directory, in order to reduce the path manipulation
done inside of the dynamic_inventory.py script. The example files were
left in the etc/openstack_deploy directory for reference.
Note that this change supports deleting elements by specifying a
empty value, such as an empty list or an empty dictionary.
When overriding, only the path to the values that changed is necessary.
For example, changing the 'is_metal' property for cinder only needs the
following in /etc/openstack_deploy/env.d/cinder.yml:
container_skel:
cinder_volumes_container:
properties:
is_metal: false
This is instead of the entirity of the container_skel dict or even the
other top-level dicts.
For AIO/gate scenarioes, the env.d copy logic has been removed, as it is
now redundant.
Change-Id: Ic637fa385fd3fec7365fb9bc5e0ff54a7f4c8bee
2016-06-21 20:56:42 -04:00
|
|
|
|
|
2016-08-31 12:31:43 +01:00
|
|
|
|
- Remove the ``physical_skel`` link between the container group and
|
2016-10-05 13:34:43 -05:00
|
|
|
|
the host group by deleting the related file located in the ``env.d/``
|
|
|
|
|
directory.
|
|
|
|
|
- Do not run the playbook that installs the component.
|
|
|
|
|
Unless you specify the component to run directly on a host by using the
|
|
|
|
|
``is_metal`` property, a container is created for this component.
|
2017-01-09 12:04:58 -05:00
|
|
|
|
- Adjust the :deploy_guide:`affinity <app-advanced-config-affinity.html>`
|
2016-10-05 13:34:43 -05:00
|
|
|
|
to 0 for the host group. Similar to the second option listed here, Unless
|
|
|
|
|
you specify the component to run directly on a host by using the``is_metal``
|
|
|
|
|
property, a container is created for this component.
|
|
|
|
|
|
|
|
|
|
Deploy existing components on dedicated hosts
|
|
|
|
|
---------------------------------------------
|
|
|
|
|
|
|
|
|
|
To deploy a ``shared-infra`` component to dedicated hosts, modify the
|
|
|
|
|
files that specify the host groups and container groups for the component.
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
|
|
container_skel:
|
|
|
|
|
galera_container:
|
|
|
|
|
belongs_to:
|
|
|
|
|
- db_containers
|
|
|
|
|
contains:
|
|
|
|
|
- galera
|
|
|
|
|
properties:
|
|
|
|
|
log_directory: mysql_logs
|
|
|
|
|
service_name: galera
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
|
|
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.
|