Tune ansible configuration for better performance

This change will update our ansible configuration to ensure we're getting the best
possible performance when running ansible playbooks via mistral.

- sets the ansible option internal_poll_interval so that we lower overall cpu
  consumption.
- sets the ssh option PreferredAuthentications so that we're only offering
  pubkeys when connecting to remote hosts which, in most cases, will save us
  from attempting a PTR lookup.

Change-Id: I421183abd0982f9f57f8719d72fd2cbf2e3d4d04
Signed-off-by: Kevin Carter <kecarter@redhat.com>
(cherry picked from commit 8ab0901ad7)
This commit is contained in:
Kevin Carter 2020-01-28 13:52:13 -06:00 committed by Jesse Pretorius (odyssey4me)
parent 0c3d972a67
commit 98a54fabf6
1 changed files with 5 additions and 1 deletions

View File

@ -111,6 +111,9 @@ def write_default_ansible_cfg(work_dir,
config.set('defaults', 'fact_caching_connection',
'/var/lib/mistral/ansible_fact_cache')
# Set the pull interval to lower CPU overhead
config.set('defaults', 'internal_poll_interval', '0.05')
# Set the interpreter discovery to auto mode.
config.set('defaults', 'interpreter_python', 'auto')
@ -124,7 +127,8 @@ def write_default_ansible_cfg(work_dir,
'-o ControlMaster=auto '
'-o ControlPersist=30m '
'-o ServerAliveInterval=5 '
'-o ServerAliveCountMax=5')
'-o ServerAliveCountMax=5 '
'-o PreferredAuthentications=publickey')
config.set('ssh_connection', 'control_path_dir',
os.path.join(work_dir, 'ansible-ssh'))
config.set('ssh_connection', 'retries', '8')