[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
changes/77/404377/6
Pavlo Shchelokovskyy 6 years ago
parent b20420ea4e
commit c3f02d1d2f
  1. 4
      ironic_staging_drivers/ansible/playbooks/add-ironic-nodes.yaml
  2. 11
      ironic_staging_drivers/ansible/playbooks/ansible.cfg
  3. 16
      ironic_staging_drivers/ansible/playbooks/callback_plugins/ironic_log.py

@ -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

@ -1,19 +1,30 @@
[defaults]
# 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
#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]
# pipelining greatly increases speed of deployment, disable it only when
# your version of ssh client on ironic node or server in bootstrap image

@ -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
CONF = cfg.CONF
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:
pass
CONF = cfg.CONF
DOMAIN = 'ironic'
version_info = pbr.version.VersionInfo(DOMAIN)
LOG = logging.getLogger(__name__, project=DOMAIN,
version=version.version_info.release_string())
version=version_info.release_string())
logging.register_options(CONF)
conf_kwargs = dict(args=[], project=DOMAIN,
version=version.version_info.release_string())
version=version_info.release_string())
if ironic_config:
conf_kwargs['default_config_files'] = [ironic_config]
CONF(**conf_kwargs)
if ironic_log_file:
CONF.set_override("log_file", ironic_log_file)
CONF.set_override("use_stderr", False)
logging.setup(CONF, DOMAIN)

Loading…
Cancel
Save