Move Ansible-deploy testing to hw types

when switching nodes to use ansible-deploy,
use the `staging-ipmi-ansible` hw type with `staging-ansible`
deploy interface instead of the classic `pxe_ipmitool_ansible` driver.

This change is backward compatible with the job definition in
project-config which must remain the same until the stable/pike and
older branches are supported.

Also, change our ansible callback plugin settings only when testing
ansible-deploy interface.

Change-Id: Iba5eb5a5aace982561d4e11042a14c2de0dd8b98
This commit is contained in:
Pavlo Shchelokovskyy 2017-08-31 11:13:21 +00:00
parent 52b1bc11d6
commit fff783fed1
1 changed files with 27 additions and 19 deletions

View File

@ -71,15 +71,6 @@ function update_ironic_enabled_drivers {
for i in $IRONIC_DRIVER_INTERFACE_TYPES; do
setup_ironic_enabled_interfaces_for $i
done
# set logging for ansible-deploy
# NOTE(pas-ha) w/o systemd or syslog, there will be no output of single
# ansible tasks to ironic log, only in the stdout returned by processutils
if [[ "$USE_SYSTEMD" == "True" ]]; then
iniset $IRONIC_STAGING_DRIVERS_DIR/ironic_staging_drivers/ansible/playbooks/callback_plugins/ironic_log.ini ironic use_journal "True"
elif [[ "$SYSLOG" == "True" ]]; then
iniset $IRONIC_STAGING_DRIVERS_DIR/ironic_staging_drivers/ansible/playbooks/callback_plugins/ironic_log.ini ironic use_syslog "True"
fi
}
function install_ironic_staging_drivers {
@ -125,14 +116,27 @@ function configure_ansible_deploy_driver {
# so just disable validating SSL certs for now in DevStack
# similar to what ironic does for IPA by default in DevStack
iniset $IRONIC_CONF_FILE ansible image_store_insecure True
# set logging for ansible-deploy
# NOTE(pas-ha) w/o systemd or syslog, there will be no output
# of single ansible tasks to ironic log,
# only in the stdout returned by processutils
if [[ "$USE_SYSTEMD" == "True" ]]; then
iniset $IRONIC_STAGING_DRIVERS_DIR/ironic_staging_drivers/ansible/playbooks/callback_plugins/ironic_log.ini ironic use_journal "True"
elif [[ "$SYSLOG" == "True" ]]; then
iniset $IRONIC_STAGING_DRIVERS_DIR/ironic_staging_drivers/ansible/playbooks/callback_plugins/ironic_log.ini ironic use_syslog "True"
fi
}
function set_ironic_testing_driver {
if [[ "$IRONIC_STAGING_DRIVER" == "pxe_ipmitool_ansible" && \
if [[ "$IRONIC_STAGING_DRIVER" =~ "ansible" && \
"$IRONIC_STAGING_DRIVER" =~ "ipmi" && \
"$IRONIC_DEPLOY_DRIVER" == "agent_ipmitool" && \
"$IRONIC_RAMDISK_TYPE" == "tinyipa" ]]; then
echo_summary "Setting nodes to use ${IRONIC_STAGING_DRIVER} driver"
echo_summary "Setting nodes to use 'staging-ansible-ipmi' hardware type with 'staging-ansible' deploy interface"
set_ansible_deploy_driver
else
die $LINENO "Failed to configure ironic to use ${IRONIC_STAGING_DRIVER} driver/hw type: not supported by devstack plugin or other pre-conditions not met"
fi
}
@ -165,14 +169,18 @@ function set_ansible_deploy_driver {
--public \
-f value -c id)
# set nodes to use ansible_deploy driver with uploaded ramdisk
# using pxe_ipmitool_ansible instead of agent_ipmitool
for node in $(openstack --os-cloud devstack baremetal node list -f value -c UUID); do
openstack --os-cloud devstack-admin baremetal node set $node \
--driver ${IRONIC_STAGING_DRIVER} \
--driver-info deploy_ramdisk=$ansible_ramdisk_id \
--driver-info ansible_deploy_username=tc \
--driver-info ansible_deploy_key_file=$ansible_key_file
# switch driver to ansible-enabled hardware type, use minimal API version that supports setting driver interfaces,
# set nodes to use the uploaded ramdisk and appropriate SSH creds.
# TODO(pas-ha) remove API version when OSC defaults to 'latest'
# TODO(pas-ha) change the job definition in project-config to set the HW type
# when stable/pike is no longer supported
openstack --os-cloud devstack-admin --os-baremetal-api-version 1.31 baremetal node set $node \
--driver staging-ansible-ipmi \
--deploy-interface staging-ansible \
--driver-info deploy_ramdisk=$ansible_ramdisk_id \
--driver-info ansible_deploy_username=tc \
--driver-info ansible_deploy_key_file=$ansible_key_file
done
}
@ -191,7 +199,7 @@ if is_service_enabled ir-api ir-cond; then
configure_ironic_testing_driver
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
if [ -n $IRONIC_STAGING_DRIVER ]; then
if [[ -n ${IRONIC_STAGING_DRIVER} ]]; then
set_ironic_testing_driver
fi
fi