Configure ansible forks based on cores
At present we use a fixed value of 36. It seems the emperical
formula is 4 forks per core ans would be automatically limited
by ansible to the number of hosts.
Change-Id: I9a9e600935e3b8443341a1dc28421a19d9978bfe
(cherry picked from commit ce948ae049
)
This commit is contained in:
parent
fa1e650307
commit
19a26f32ae
|
@ -31,6 +31,7 @@ import logging
|
||||||
from six.moves.configparser import ConfigParser
|
from six.moves.configparser import ConfigParser
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import multiprocessing
|
||||||
import netaddr
|
import netaddr
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
@ -477,7 +478,7 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
|
||||||
'-T'
|
'-T'
|
||||||
).format(os.devnull)
|
).format(os.devnull)
|
||||||
env['ANSIBLE_DISPLAY_FAILED_STDERR'] = True
|
env['ANSIBLE_DISPLAY_FAILED_STDERR'] = True
|
||||||
env['ANSIBLE_FORKS'] = 36
|
env['ANSIBLE_FORKS'] = multiprocessing.cpu_count() * 4
|
||||||
env['ANSIBLE_TIMEOUT'] = ansible_timeout
|
env['ANSIBLE_TIMEOUT'] = ansible_timeout
|
||||||
env['ANSIBLE_GATHER_TIMEOUT'] = 45
|
env['ANSIBLE_GATHER_TIMEOUT'] = 45
|
||||||
env['ANSIBLE_SSH_RETRIES'] = 3
|
env['ANSIBLE_SSH_RETRIES'] = 3
|
||||||
|
|
Loading…
Reference in New Issue