Move inventory files to folder in root of repo

Move the playbooks/inventory folder, group_vars, and host_vars to
inventory/ in the root of the OpenStack-Ansible repo. This helps better
organize the repo structure since playbooks/ will now only contain
playbooks, shared task files, and included repo package var files.

group_vars and host_vars are moved alongside the inventory since that's
the default place that Ansible expects those folders and to help better
prepare for Ansible 2.4 where multiple inventories can be loaded,
automatically including relative group and host var files.

Effected docs, scripts, and variables have been updated with the new
paths.

Change-Id: If50e2412c3fd6575d7041deb8ecc9480b04184cc
This commit is contained in:
Jimmy McCrory 2017-10-28 16:03:55 -07:00
parent 8f68f4b17f
commit c5551f2c8c
105 changed files with 21 additions and 21 deletions

View File

@ -29,7 +29,7 @@ import sys
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../playbooks/inventory/')) sys.path.insert(0, os.path.abspath('../../inventory/'))
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------

View File

@ -82,7 +82,7 @@ OpenStack-Ansible) are as follows:
may reference. may reference.
``ANSIBLE_INVENTORY`` ``ANSIBLE_INVENTORY``
This variable should point to This variable should point to
``openstack-ansible/playbooks/inventory``. With this setting, ``openstack-ansible/inventory/dynamic_inventory.py``. With this setting,
extensions have access to the same dynamic inventory that extensions have access to the same dynamic inventory that
OpenStack-Ansible uses. OpenStack-Ansible uses.
@ -110,7 +110,7 @@ The ``/etc/openstack_deploy/env.d`` directory sources all YAML files into the
deployed environment, allowing a deployer to define additional group mappings. deployed environment, allowing a deployer to define additional group mappings.
This directory is used to extend the environment skeleton, or modify the This directory is used to extend the environment skeleton, or modify the
defaults defined in the ``playbooks/inventory/env.d`` directory. defaults defined in the ``inventory/env.d`` directory.
See also See also
:deploy_guide:`Understanding Container Groups <app-custom-layouts.html>` :deploy_guide:`Understanding Container Groups <app-custom-layouts.html>`

View File

@ -40,7 +40,7 @@ needed in an environment, it is possible to create additional nodes.
.. code:: console .. code:: console
# /opt/openstack-ansible/playbooks/inventory/dynamic_inventory.py > /dev/null # /opt/openstack-ansible/inventory/dynamic_inventory.py > /dev/null
#. Create the ``/root/add_host.limit`` file, which contains all new node #. Create the ``/root/add_host.limit`` file, which contains all new node
host names. Replace ``<NEW INFRA NODE>`` with the name of the new host. host names. Replace ``<NEW INFRA NODE>`` with the name of the new host.

View File

@ -41,7 +41,7 @@ with open(TABLE_FILE, 'a+') as f:
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../playbooks/inventory/')) sys.path.insert(0, os.path.abspath('../../inventory/'))
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------

View File

@ -275,7 +275,7 @@ Deploying the role
run the ``repo-build.yml`` play later so that wheels for your packages will run the ``repo-build.yml`` play later so that wheels for your packages will
be included in the repository infrastructure. be included in the repository infrastructure.
#. Make any required adjustments to the load balancer configuration #. Make any required adjustments to the load balancer configuration
(e.g. modify ``playbooks/inventory/group_vars/all/haproxy.yml`` in the (e.g. modify ``inventory/group_vars/all/haproxy.yml`` in the
OpenStack-Ansible source repository on your deploy host) so that your OpenStack-Ansible source repository on your deploy host) so that your
service can be reached through a load balancer, if appropriate, and be sure service can be reached through a load balancer, if appropriate, and be sure
to run the ``haproxy-install.yml`` play later so your changes will be to run the ``haproxy-install.yml`` play later so your changes will be
@ -295,7 +295,7 @@ Deploying the role
hosts, Ansible skips the playbook's tasks automatically. hosts, Ansible skips the playbook's tasks automatically.
#. Any variables needed by other roles to connect to the new role, or by the #. Any variables needed by other roles to connect to the new role, or by the
new role to connect to other roles, should be implemented in new role to connect to other roles, should be implemented in
``playbooks/inventory/group_vars``. The group vars are essentially the ``inventory/group_vars``. The group vars are essentially the
glue which playbooks use to ensure that all roles are given the glue which playbooks use to ensure that all roles are given the
appropriate information. When group vars are implemented it should be a appropriate information. When group vars are implemented it should be a
minimum set to achieve the goal of integrating the new role into the minimum set to achieve the goal of integrating the new role into the

View File

@ -6,7 +6,7 @@ Changing the base environment directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``--environment/-e`` argument will take the path to a directory containing The ``--environment/-e`` argument will take the path to a directory containing
an ``env.d`` directory. This defaults to ``playbooks/inventory/`` in the an ``env.d`` directory. This defaults to ``inventory/`` in the
OpenStack-Ansible codebase. OpenStack-Ansible codebase.
Contents of this directory are populated into the environment *before* the Contents of this directory are populated into the environment *before* the

View File

@ -3,7 +3,7 @@ Generating the Inventory
======================== ========================
The script that creates the inventory is located at The script that creates the inventory is located at
``playbooks/inventory/dynamic_inventory.py``. ``inventory/dynamic_inventory.py``.
Executing the dynamic_inventory.py script Executing the dynamic_inventory.py script
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -16,7 +16,7 @@ Run the following command:
.. code-block:: bash .. code-block:: bash
# from the playbooks directory # from the root folder of cloned OpenStack-Ansible repository
inventory/dynamic_inventory.py --config /etc/openstack_deploy/ inventory/dynamic_inventory.py --config /etc/openstack_deploy/
This invocation is useful when testing changes to the dynamic inventory script. This invocation is useful when testing changes to the dynamic inventory script.
@ -29,7 +29,7 @@ holding configuration from which to create the inventory. If not specified,
the default is ``/etc/openstack_deploy/``. the default is ``/etc/openstack_deploy/``.
In addition to this argument, the base environment skeleton is provided in the In addition to this argument, the base environment skeleton is provided in the
``playbooks/inventory/env.d`` directory of the OpenStack-Ansible codebase. ``inventory/env.d`` directory of the OpenStack-Ansible codebase.
Should an ``env.d`` directory be found in the directory specified by Should an ``env.d`` directory be found in the directory specified by
``--config``, its contents will be added to the base environment, overriding ``--config``, its contents will be added to the base environment, overriding
@ -70,13 +70,13 @@ As an example, consider the following excerpt from
The ``identity_hosts`` dictionary defines an Ansible inventory group named The ``identity_hosts`` dictionary defines an Ansible inventory group named
``identity_hosts`` containing the three infra hosts. The configuration file ``identity_hosts`` containing the three infra hosts. The configuration file
``playbooks/inventory/env.d/keystone.yml`` defines additional Ansible ``inventory/env.d/keystone.yml`` defines additional Ansible
inventory groups for the containers that are deployed onto the three hosts inventory groups for the containers that are deployed onto the three hosts
named with the prefix *infra*. named with the prefix *infra*.
Note that any services marked with ``is_metal: true`` will run on the allocated Note that any services marked with ``is_metal: true`` will run on the allocated
physical host and not in a container. For an example of ``is_metal: true`` physical host and not in a container. For an example of ``is_metal: true``
being used refer to ``playbooks/inventory/env.d/cinder.yml`` in the being used refer to ``inventory/env.d/cinder.yml`` in the
``container_skel`` section. ``container_skel`` section.
Outputs Outputs

View File

@ -23,7 +23,7 @@ try:
from osa_toolkit import generate from osa_toolkit import generate
except ImportError: except ImportError:
current_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) current_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
lib_path = os.path.join(current_path, '..', '..', 'osa_toolkit') lib_path = os.path.join(current_path, '..')
sys.path.append(lib_path) sys.path.append(lib_path)
from osa_toolkit import generate from osa_toolkit import generate
@ -67,7 +67,7 @@ def args(arg_list):
'-e', '-e',
'--environment', '--environment',
help=('Directory that contains the base env.d directory.\n' help=('Directory that contains the base env.d directory.\n'
'Defaults to <OSA_ROOT>/playbooks/inventory/.'), 'Defaults to <OSA_ROOT>/inventory/.'),
required=False, required=False,
default=os.path.dirname(__file__), default=os.path.dirname(__file__),
) )

Some files were not shown because too many files have changed in this diff Show More