Merge "Implement Ansible fact cache for Mistral executor" into stable/queens

This commit is contained in:
Zuul 2019-10-07 14:52:14 +00:00 committed by Gerrit Code Review
commit 9e1476cbbb
2 changed files with 17 additions and 0 deletions

View File

@ -30,6 +30,14 @@ export ANSIBLE_RETRY_FILES_ENABLED=False
# Add `-E` to the sudo flags to preserve the shell environment. The `-H -S -n`
# options are Ansible's default values.
export ANSIBLE_SUDO_FLAGS="-H -S -n -E"
# Use a fact cache to improve performance
# The defaults from tripleo_common/actions/ansible.py cannot be used
# beause they will clash with the 'mistral' user owning the fact cache
# path.
export ANSIBLE_GATHERING=smart
export ANSIBLE_CACHE_PLUGIN=jsonfile
export ANSIBLE_CACHE_PLUGIN_CONNECTION=~/ansible_fact_cache
export ANSIBLE_GATHER_TIMEOUT=7200 # 7200s = 2h
export ANSIBLE_PRIVATE_KEY_FILE=$IDENTITY_FILE

View File

@ -48,6 +48,15 @@ def write_default_ansible_cfg(work_dir,
config.set('defaults', 'timeout', '30')
config.set('defaults', 'gather_timeout', '30')
# Setup fact cache to improve playbook execution speed
config.set('defaults', 'gathering', 'smart')
config.set('defaults', 'fact_caching', 'jsonfile')
config.set('defaults', 'fact_caching_connection',
'/var/tmp/ansible_fact_cache')
# Expire facts in the fact cache after 7200s (2h)
config.set('defaults', 'fact_caching_timeout', '7200')
# mistral user has no home dir set, so no place to save a known hosts file
config.set('ssh_connection', 'ssh_args',
'-o UserKnownHostsFile=/dev/null '