Add kolla-ansible gather-facts command

In some situations it may be helpful to populate the fact cache on
demand. The 'kolla-ansible gather-facts' command may be used to do this.

One specific case where this may be helpful is when running kolla-ansible
with a --limit argument, since in that case hosts that match the limit
will gather facts for hosts that fall outside the limit. In the extreme
case of a limit that matches only one host, it will serially gather
facts for all other hosts. To avoid this issue, run 'kolla-ansible
gather-facts' without a limit to populate the fact cache in parallel
before running the required command with a limit.

Change-Id: I79db9bca23aa1bd45bafa7e7500a90de5a684593
This commit is contained in:
Mark Goddard 2021-06-03 16:23:00 +01:00
parent ea008fd7fe
commit d9a3758952
4 changed files with 33 additions and 0 deletions

View File

@ -65,6 +65,25 @@ the `jsonfile cache plugin
You may also wish to set the expiration timeout for the cache via ``[defaults] You may also wish to set the expiration timeout for the cache via ``[defaults]
fact_caching_timeout``. fact_caching_timeout``.
Populating the cache
~~~~~~~~~~~~~~~~~~~~
In some situations it may be helpful to populate the fact cache on demand. The
``kolla-ansible gather-facts`` command may be used to do this.
One specific case where this may be helpful is when running ``kolla-ansible``
with a ``--limit`` argument, since in that case hosts that match the limit will
gather facts for hosts that fall outside the limit. In the extreme case of a
limit that matches only one host, it will serially gather facts for all other
hosts. To avoid this issue, run ``kolla-ansible gather-facts`` without a limit
to populate the fact cache in parallel before running the required command with
a limit. For example:
.. code-block:: console
kolla-ansible gather-facts
kolla-ansible deploy --limit control01
Fact variable injection Fact variable injection
----------------------- -----------------------

View File

@ -207,6 +207,9 @@ times. This can be useful to share configuration between multiple environments.
Any common configuration can be set in ``INVENTORY1`` and ``INVENTORY2`` can be Any common configuration can be set in ``INVENTORY1`` and ``INVENTORY2`` can be
used to set environment specific details. used to set environment specific details.
``kolla-ansible -i INVENTORY gather-facts`` is used to gather Ansible facts,
for example to populate a fact cache.
.. note:: .. note::
In order to do smoke tests, requires ``kolla_enable_sanity_checks=yes``. In order to do smoke tests, requires ``kolla_enable_sanity_checks=yes``.

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds a ``kolla-ansible gather-facts`` command that may be used to gather
Ansible host facts.

View File

@ -161,6 +161,7 @@ Commands:
deploy-bifrost Deploy and start bifrost container deploy-bifrost Deploy and start bifrost container
deploy-servers Enroll and deploy servers with bifrost deploy-servers Enroll and deploy servers with bifrost
deploy-containers Only deploy and start containers (no config updates or bootstrapping) deploy-containers Only deploy and start containers (no config updates or bootstrapping)
gather-facts Gather Ansible facts
post-deploy Do post deploy on deploy node post-deploy Do post deploy on deploy node
pull Pull all images for containers (only pulls, no running container changes) pull Pull all images for containers (only pulls, no running container changes)
reconfigure Reconfigure OpenStack service reconfigure Reconfigure OpenStack service
@ -203,6 +204,7 @@ deploy
deploy-bifrost deploy-bifrost
deploy-containers deploy-containers
deploy-servers deploy-servers
gather-facts
post-deploy post-deploy
pull pull
reconfigure reconfigure
@ -429,6 +431,10 @@ EOF
PLAYBOOK="${BASEDIR}/ansible/bifrost.yml" PLAYBOOK="${BASEDIR}/ansible/bifrost.yml"
EXTRA_OPTS="$EXTRA_OPTS -e kolla_action=deploy-servers" EXTRA_OPTS="$EXTRA_OPTS -e kolla_action=deploy-servers"
;; ;;
(gather-facts)
ACTION="Gathering Ansible facts"
PLAYBOOK="${BASEDIR}/ansible/gather-facts.yml"
;;
(post-deploy) (post-deploy)
ACTION="Post-Deploying Playbooks" ACTION="Post-Deploying Playbooks"
PLAYBOOK="${BASEDIR}/ansible/post-deploy.yml" PLAYBOOK="${BASEDIR}/ansible/post-deploy.yml"