What is Overlay and why should I use it?
One of the major advantages I gain by operating my cloud using OpenStack-Ansible (OSA) as the deployment system is the ability to easily adapt my OpenStack cloud for a variety of environments. However, when maintaining these deployments across upgrades and over time, it can become a challenge to merge user space configurations with changes to the upstream OpenStack-Ansible repository.
What I needed was a way to add additional services and playbooks and deploy various layers of user-space configuration to my OpenStack-Ansible setup without modifying the base OSA repository.
After experimenting with several methods, I found the rpc-openstack repository and built an OpenStack-Ansible overlay inspired by rpc-openstack’s structure.
Where can I find Overlay?
The openstack-ansible-overlay repository is located on GitHub. Included in the repository are scripts used to perform the configuration merging and deployment of overlay playbooks.
How do I use Overlay?
The example overlay repository contains an example of an NTP role added to the OpenStack-Ansible environment. To test out the example Overlay, we can build an AIO as follows. The AIO build is almost identical to the build created by following the OpenStack-Ansible Quick Start guide.
Directory structure of the example overlay repository:
Configuration overrides can be placed in
After making changes to these files, run
scripts/deploy.sh again. To rebuild
/etc/openstack_deploy without executing the playbooks, run
When these scripts are executed, the configuration files are merged from the following directories:
If, for example, a file named
user_variables.yml exists in all 3 directories
above, then the one included in the openstack-ansible repository will be used as
the base, and the overlay/env overrides and overlay/local overrides will be
merged on top in that order.
Files do not need to exist in all 3 layers to be
merged. If a file only exists in
local, then the
env file will be
treated as the default, and the
local file will be merged on top.
Using this format it is possible to have a base
set of organizational configuration variables defined in
env, while variables
for a specific region can be added in
Group Variable Overrides
Group variables can be merged the same way as global configuration variables. To
configure group variable overrides, drop configurations in
local/group_vars, then update the merged configurations using
Group variables are merged in the following order:
Environment overrides are merged using files from
in a similar fashion to the vars files above. However, since OSA includes
environment override support as of Newton, env.d overrides do not need to be
merged with the base environment in the OSA tree. Due to this, environment
overrides are merged in the following order:
A note about configuration files
Files in the following directories are dynamically generated and should not be modified manually.
Additional roles can be added to the
ansible-role-requirements.yml file, and
playbooks can be added to
Then, deployment scripts can be added to
be modified to execute the additional playbooks.
The example repository is meant to be forked and extended further. It was created to demonstrate extension of OpenStack-Ansible’s core feature set and facilitate the construction of maintainable configurations for clouds deployed by OpenStack-Ansible.