[ansible] fix some places for Ansible 2.2

Changes include:

- callback plugin - fixed for Ansible 2.2

  Apparently now `eventlet.monkey_patch()` breaks Ansible,
  and since it is implicitly executed on any import from ironic package,
  it breaks the callback plugin and the whole ansible-deploy driver
  when using Ansible 2.2.
  Instead, just copy-paste those several lines of code explicitly
  into callback plugin module or use them from ironic_staging_drivers
  code.

- ansible.cfg - add interprocess polling interval option.

  Increasing it should decrease CPU load generated by each
  ansible-playbook invocation and improve ironic-conductor performance
  for parallel deployment of nodes with ansible-deploy driver

- in-memory inventory playbook - changed add_host module args to
  correspond to Ansible 2.x

Change-Id: I365a82cd3592a7669599fe84674ca4abab8f576f
Closes-Bug: #1652326
This commit is contained in:
Pavlo Shchelokovskyy 2016-10-04 17:50:17 +03:00
parent b20420ea4e
commit c3f02d1d2f
3 changed files with 22 additions and 9 deletions

View File

@ -4,8 +4,8 @@
- add_host: - add_host:
group: ironic group: ironic
hostname: "{{ item.name }}" hostname: "{{ item.name }}"
ansible_ssh_host: "{{ item.ip }}" ansible_host: "{{ item.ip }}"
ansible_ssh_user: "{{ item.user }}" ansible_user: "{{ item.user }}"
ironic_extra: "{{ item.extra | default({}) }}" ironic_extra: "{{ item.extra | default({}) }}"
with_items: "{{ ironic_nodes }}" with_items: "{{ ironic_nodes }}"
tags: always tags: always

View File

@ -1,19 +1,30 @@
[defaults] [defaults]
# retries through the ansible-deploy driver are not supported # retries through the ansible-deploy driver are not supported
retry_files_enabled = False retry_files_enabled = False
# this is using supplied callback_plugin to interleave ansible event logs # this is using supplied callback_plugin to interleave ansible event logs
# into Ironic-conductor log as set in ironic configuration file, # into Ironic-conductor log as set in ironic configuration file,
# see callback_plugin/ironic_log.ini for some options to set # see callback_plugin/ironic_log.ini for some options to set
# (DevStack _needs_ some tweaks) # (DevStack _needs_ some tweaks)
callback_whitelist = ironic_log callback_whitelist = ironic_log
# For better security, bake SSH host keys into bootstrap image, # For better security, bake SSH host keys into bootstrap image,
# add those to ~/.ssh/known_hosts for user running ironic-conductor service # add those to ~/.ssh/known_hosts for user running ironic-conductor service
# on all nodes where ironic-conductor and ansible-deploy driver are installed, # on all nodes where ironic-conductor and ansible-deploy driver are installed,
# and set the host_key_checking to True (or comment it out, it is the default) # and set the host_key_checking to True (or comment it out, it is the default)
host_key_checking = False host_key_checking = False
# uncomment if you have problem with ramdisk locale on ansible >= 2.1 # uncomment if you have problem with ramdisk locale on ansible >= 2.1
#module_set_locale=False #module_set_locale=False
# This sets the interval (in seconds) of Ansible internal processes polling
# each other. Lower values improve performance with large playbooks at
# the expense of extra CPU load. Higher values are more suitable for Ansible
# usage in automation scenarios, when UI responsiveness is not required but
# CPU usage might be a concern.
# Default corresponds to the value hardcoded in Ansible ≤ 2.1:
#internal_poll_interval = 0.001
[ssh_connection] [ssh_connection]
# pipelining greatly increases speed of deployment, disable it only when # pipelining greatly increases speed of deployment, disable it only when
# your version of ssh client on ironic node or server in bootstrap image # your version of ssh client on ironic node or server in bootstrap image

View File

@ -16,11 +16,14 @@ import os
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import pbr.version
from ironic.common import i18n from ironic_staging_drivers.common import i18n
from ironic import version
CONF = cfg.CONF
DOMAIN = 'ironic'
# parse callback plugin config and Ironic config, setup logging
basename = os.path.splitext(__file__)[0] basename = os.path.splitext(__file__)[0]
config = ConfigParser.ConfigParser() config = ConfigParser.ConfigParser()
ironic_config = None ironic_config = None
@ -34,21 +37,20 @@ try:
except Exception: except Exception:
pass pass
CONF = cfg.CONF version_info = pbr.version.VersionInfo(DOMAIN)
DOMAIN = 'ironic'
LOG = logging.getLogger(__name__, project=DOMAIN, LOG = logging.getLogger(__name__, project=DOMAIN,
version=version.version_info.release_string()) version=version_info.release_string())
logging.register_options(CONF) logging.register_options(CONF)
conf_kwargs = dict(args=[], project=DOMAIN, conf_kwargs = dict(args=[], project=DOMAIN,
version=version.version_info.release_string()) version=version_info.release_string())
if ironic_config: if ironic_config:
conf_kwargs['default_config_files'] = [ironic_config] conf_kwargs['default_config_files'] = [ironic_config]
CONF(**conf_kwargs) CONF(**conf_kwargs)
if ironic_log_file: if ironic_log_file:
CONF.set_override("log_file", ironic_log_file) CONF.set_override("log_file", ironic_log_file)
CONF.set_override("use_stderr", False)
logging.setup(CONF, DOMAIN) logging.setup(CONF, DOMAIN)