[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

- 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:
group: ironic
hostname: "{{ item.name }}"
ansible_ssh_host: "{{ item.ip }}"
ansible_ssh_user: "{{ item.user }}"
ansible_host: "{{ item.ip }}"
ansible_user: "{{ item.user }}"
ironic_extra: "{{ item.extra | default({}) }}"
with_items: "{{ ironic_nodes }}"
tags: always

View File

@ -1,19 +1,30 @@
# retries through the ansible-deploy driver are not supported
retry_files_enabled = False
# this is using supplied callback_plugin to interleave ansible event logs
# into Ironic-conductor log as set in ironic configuration file,
# see callback_plugin/ironic_log.ini for some options to set
# (DevStack _needs_ some tweaks)
callback_whitelist = ironic_log
# For better security, bake SSH host keys into bootstrap image,
# add those to ~/.ssh/known_hosts for user running ironic-conductor service
# 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)
host_key_checking = False
# uncomment if you have problem with ramdisk locale on ansible >= 2.1
# 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
# pipelining greatly increases speed of deployment, disable it only when
# 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_log import log as logging
import pbr.version
from ironic.common import i18n
from ironic import version
from ironic_staging_drivers.common import i18n
DOMAIN = 'ironic'
# parse callback plugin config and Ironic config, setup logging
basename = os.path.splitext(__file__)[0]
config = ConfigParser.ConfigParser()
ironic_config = None
@ -34,21 +37,20 @@ try:
except Exception:
DOMAIN = 'ironic'
version_info = pbr.version.VersionInfo(DOMAIN)
LOG = logging.getLogger(__name__, project=DOMAIN,
conf_kwargs = dict(args=[], project=DOMAIN,
if ironic_config:
conf_kwargs['default_config_files'] = [ironic_config]
if ironic_log_file:
CONF.set_override("log_file", ironic_log_file)
CONF.set_override("use_stderr", False)
logging.setup(CONF, DOMAIN)