Reduce the default fact gather subset

This patch implements a new default subset of facts being gathered
to a much smaller set. This should improve performance in large
environments. Deployers who need a greater subset are able to use
the standard Ansible environment variables to override our default
value.

Change-Id: I741228ba03ad5081fbea5833143fdf1f1e8d3623
This commit is contained in:
Jesse Pretorius 2016-09-05 13:55:57 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 8372bb6982
commit eeaa4334e4
3 changed files with 17 additions and 2 deletions

View File

@ -0,0 +1,13 @@
---
features:
- In order to reduce the time taken for fact gathering, the default
subset gathered has been reduced to a smaller set than the Ansible
default. This may be changed by the deployer by setting the
``ANSIBLE_GATHER_SUBSET`` variable in the bash environment prior
to executing any ansible commands.
upgrade:
- In order to reduce the time taken for fact gathering, the default
subset gathered has been reduced to a smaller set than the Ansible
default. This may be changed by the deployer by setting the
``ANSIBLE_GATHER_SUBSET`` variable in the bash environment prior
to executing any ansible commands.

View File

@ -26,6 +26,8 @@ export ANSIBLE_ACTION_PLUGINS="${ANSIBLE_ACTION_PLUGINS:-/etc/ansible/roles/plug
export ANSIBLE_CALLBACK_PLUGINS="${ANSIBLE_CALLBACK_PLUGINS:-/etc/ansible/roles/plugins/callback}"
export ANSIBLE_GATHERING="${ANSIBLE_GATHERING:-smart}"
export ANSIBLE_GATHER_SUBSET="${ANSIBLE_GATHER_SUBSET:-network,hardware,virtual}"
export ANSIBLE_CACHE_PLUGIN="${ANSIBLE_CACHE_PLUGIN:-jsonfile}"
export ANSIBLE_CACHE_PLUGIN_CONNECTION="${ANSIBLE_CACHE_PLUGIN_CONNECTION:-/etc/openstack_deploy/ansible_facts}"
export ANSIBLE_CACHE_PLUGIN_TIMEOUT="${ANSIBLE_CACHE_PLUGIN_TIMEOUT:-86400}"

View File

@ -49,14 +49,14 @@ function playbook_run {
# First we gather facts about the hosts to populate the fact cache.
# We can't gather the facts for all hosts yet because the containers
# aren't built yet.
ansible -m setup -a "gather_subset=!facter,!ohai" hosts
ansible -m setup -a "gather_subset=network,hardware,virtual" hosts
for root_include in $(awk -F'include:' '{print $2}' setup-everything.yml); do
# Once setup-hosts is complete, we should gather facts for everything
# (now including containers) so that the fact cache is complete for the
# remainder of the run.
if [[ "${root_include}" == "setup-infrastructure.yml" ]]; then
ansible -m setup -a "gather_subset=!facter,!ohai" all
ansible -m setup -a "gather_subset=network,hardware,virtual" all
fi
for include in $(awk -F'include:' '{print $2}' "${root_include}"); do
echo "[Executing \"${include}\" playbook]"