From f6d8c0d481306a45d61ed224c02ff12615e83ec9 Mon Sep 17 00:00:00 2001 From: Konstantinos Mouzakitis Date: Tue, 9 Jun 2020 12:59:52 -0400 Subject: [PATCH] Adding support for multiple globals files Added a spec file for this blueprint. Changed the kolla-ansible script to accept more than one globals.yml file. That will still be the main one but operators will be able to create more, under the /etc/kolla/globals.d directory. Also added some paragraphs in the quickstart documentation about this. Finally, Adding a release note Change-Id: I34eb91d0e2ed80694594b8fc6801cf8ad77da754 Implements: blueprint multiple-globals-files --- doc/source/user/quickstart.rst | 15 ++++ ...lobals-files-support-a75bde9f02b7b022.yaml | 7 ++ specs/multiple-globals-files.rst | 88 +++++++++++++++++++ tools/kolla-ansible | 4 +- 4 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/add-multiple-globals-files-support-a75bde9f02b7b022.yaml create mode 100644 specs/multiple-globals-files.rst diff --git a/doc/source/user/quickstart.rst b/doc/source/user/quickstart.rst index ee14729e2b..f0496c0a9c 100644 --- a/doc/source/user/quickstart.rst +++ b/doc/source/user/quickstart.rst @@ -453,6 +453,21 @@ There are a few options that are required to deploy Kolla-Ansible: :kolla-ansible-doc:`Services Reference Guide `. +* Multiple globals files + + For a more granular control, enabling any option from the main + ``globals.yml`` file can now be done using multiple yml files. Simply, + create a directory called ``globals.d`` under ``/etc/kolla/`` and place + all the relevant ``*.yml`` files in there. The ``kolla-ansible`` script + will, automatically, add all of them as arguments to the ``ansible-playbook`` + command. + + An example use case for this would be if an operator wants to enable cinder + and all its options, at a later stage than the initial deployment, without + tampering with the existing ``globals.yml`` file. That can be achieved, using + a separate ``cinder.yml`` file, placed under the ``/etc/kolla/globals.d/`` + directory and adding all the relevant options in there. + * Virtual environment It is recommended to use a virtual environment to execute tasks on the remote diff --git a/releasenotes/notes/add-multiple-globals-files-support-a75bde9f02b7b022.yaml b/releasenotes/notes/add-multiple-globals-files-support-a75bde9f02b7b022.yaml new file mode 100644 index 0000000000..e90b685b4c --- /dev/null +++ b/releasenotes/notes/add-multiple-globals-files-support-a75bde9f02b7b022.yaml @@ -0,0 +1,7 @@ +--- +features: + - Adds support for multiple globals files. + The main ``globals.yml`` file still exists. In addition to that, + operators can now create a ``globals.d`` directory (next to + ``globals.yml``), where they can place any number of ``*.yml`` files, + for example for specific services they want to add. diff --git a/specs/multiple-globals-files.rst b/specs/multiple-globals-files.rst new file mode 100644 index 0000000000..ab9dc8767b --- /dev/null +++ b/specs/multiple-globals-files.rst @@ -0,0 +1,88 @@ +.. + This work is licensed under a Creative Commons Attribution 3.0 Unported + License. + + http://creativecommons.org/licenses/by/3.0/legalcode + +.. + This template should be in ReSTructured text. The filename in the git + repository should match the launchpad URL, for example a URL of + https://blueprints.launchpad.net/kolla/+spec/awesome-thing should be named + awesome-thing.rst . Please do not delete any of the sections in this + template. If you have nothing to say for a whole section, just write: None + For help with syntax, see http://www.sphinx-doc.org/en/stable/rest.html + To test out your formatting, see http://www.tele3.cz/jbar/rest/rest.html + +====================================== +Add support for multiple globals files +====================================== + +https://blueprints.launchpad.net/kolla-ansible/+spec/multiple-globals-files + +Adding this feature to the kolla-ansible script, which will make it, automatically, +read multiple globals files. This would give operators the ability to have +separate globals files for some services, giving them a bit more granular control, +without the need to add the ``-e @/path/to/file`` flag. These files will be placed +under a new ``/etc/kolla/globals.d`` directory and ``kolla-ansible`` will search +for ``globals.d/*.yml`` files. The main ``globals.yml`` file will still exist +under ``/etc/kolla``, as usual. + +Problem description +=================== + +There's no problem, per say, to solve. This feature will basically give operators +the ability to have separate globals files for some services, giving them a bit +more granular control, without the need to add the ``-e @/path/to/file`` flag. + +Use cases +--------- +1. Allow a more granular controler over individual service's options +2. Better file and directory structure + +Proposed change +=============== + +- Add the capability in the ``tools/kolla-ansible`` script + - Check if the ``globals.d`` directory exists + - If it is, add its files in the ``CONFIG_OPTS`` variable at the end of the ``tools/kolla-ansible`` script + +Security impact +--------------- + +None + +Performance Impact +------------------ + +None + + +Implementation +============== + +Assignee(s) +----------- + +Konstantinos Mouzaitis + +Milestones +---------- + +Target Milestone for completion: + ussuri-10.0.0 + +Work Items +---------- + +- Add the capability in the ``tools/kolla-ansible`` script + - Check if the ``globals.d`` directory exists + - If it is, add its files in the ``CONFIG_OPTS`` variable at the end of the ``tools/kolla-ansible`` script + +Testing +======= +Test the new kolla-ansible script when the ``globals.d`` directory exists and +includes some more yml files, as well as when it doesn't exist. + +Documentation Impact +==================== +``doc/source/user/quickstart.rst`` will need to be updated to include the options discussed in this feature diff --git a/tools/kolla-ansible b/tools/kolla-ansible index dfc98cec5d..fca10ea717 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -452,6 +452,8 @@ EOF ;; esac -CONFIG_OPTS="-e @${CONFIG_DIR}/globals.yml -e @${PASSWORDS_FILE} -e CONFIG_DIR=${CONFIG_DIR}" +GLOBALS_DIR="${CONFIG_DIR}/globals.d" +EXTRA_GLOBALS=$(find ${GLOBALS_DIR} -maxdepth 1 -type f -name '*.yml' -printf ' -e @%p') +CONFIG_OPTS="-e @${CONFIG_DIR}/globals.yml ${EXTRA_GLOBALS} -e @${PASSWORDS_FILE} -e CONFIG_DIR=${CONFIG_DIR}" CMD="ansible-playbook -i $INVENTORY $CONFIG_OPTS $EXTRA_OPTS $PLAYBOOK $VERBOSITY" process_cmd