From d9a3758952a0689e0608543c12c712b48fed33e7 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 3 Jun 2021 16:23:00 +0100 Subject: [PATCH] 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 --- doc/source/user/ansible-tuning.rst | 19 +++++++++++++++++++ doc/source/user/operating-kolla.rst | 3 +++ ...gather-facts-command-7b62d2c3eb13ec8e.yaml | 5 +++++ tools/kolla-ansible | 6 ++++++ 4 files changed, 33 insertions(+) create mode 100644 releasenotes/notes/gather-facts-command-7b62d2c3eb13ec8e.yaml diff --git a/doc/source/user/ansible-tuning.rst b/doc/source/user/ansible-tuning.rst index e8f39ac0c1..019dddedd6 100644 --- a/doc/source/user/ansible-tuning.rst +++ b/doc/source/user/ansible-tuning.rst @@ -65,6 +65,25 @@ the `jsonfile cache plugin You may also wish to set the expiration timeout for the cache via ``[defaults] 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 ----------------------- diff --git a/doc/source/user/operating-kolla.rst b/doc/source/user/operating-kolla.rst index 5c3ed3b12b..98543a7289 100644 --- a/doc/source/user/operating-kolla.rst +++ b/doc/source/user/operating-kolla.rst @@ -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 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:: In order to do smoke tests, requires ``kolla_enable_sanity_checks=yes``. diff --git a/releasenotes/notes/gather-facts-command-7b62d2c3eb13ec8e.yaml b/releasenotes/notes/gather-facts-command-7b62d2c3eb13ec8e.yaml new file mode 100644 index 0000000000..8f8a5c847f --- /dev/null +++ b/releasenotes/notes/gather-facts-command-7b62d2c3eb13ec8e.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds a ``kolla-ansible gather-facts`` command that may be used to gather + Ansible host facts. diff --git a/tools/kolla-ansible b/tools/kolla-ansible index 05e40d313b..d733c22be6 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -161,6 +161,7 @@ Commands: deploy-bifrost Deploy and start bifrost container deploy-servers Enroll and deploy servers with bifrost 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 pull Pull all images for containers (only pulls, no running container changes) reconfigure Reconfigure OpenStack service @@ -203,6 +204,7 @@ deploy deploy-bifrost deploy-containers deploy-servers +gather-facts post-deploy pull reconfigure @@ -429,6 +431,10 @@ EOF PLAYBOOK="${BASEDIR}/ansible/bifrost.yml" EXTRA_OPTS="$EXTRA_OPTS -e kolla_action=deploy-servers" ;; +(gather-facts) + ACTION="Gathering Ansible facts" + PLAYBOOK="${BASEDIR}/ansible/gather-facts.yml" + ;; (post-deploy) ACTION="Post-Deploying Playbooks" PLAYBOOK="${BASEDIR}/ansible/post-deploy.yml"