undercloud_post: manage post mistral config

- Replicate what has been done in _post_config_mistral
  (instack-undercloud)
- Cleanup cron triggers before cleaning workflows.
- Re-create publish-ui-logs-hourly cron trigger.
- If validations are enabled, execute copy_ssh_key workflow.

Depends-On: I10abed7f1514e9d72d5ebac0c85bad11cdf3210f
Depends-On: I01c4497324b2c8666d9f749147693d580c0a5e20
Change-Id: If641a9f91c85a0dcc5fcd8d89784ff4258123ea7
This commit is contained in:
Emilien Macchi 2018-03-08 22:09:57 +01:00
parent c1b35f07ac
commit 33abdba533
2 changed files with 28 additions and 4 deletions

View File

@ -157,22 +157,39 @@ fi
# MISTRAL WORKFLOW CONFIGURATION
if [ "$(hiera mistral_api_enabled)" = "true" ]; then
# load workflows
echo Configuring Mistral workbooks.
for workbook in $(openstack workbook list | grep tripleo | cut -f 2 -d ' '); do
openstack workbook delete $workbook
done
for workflow in $(openstack workflow list | grep tripleo | cut -f 2 -d ' '); do
openstack workflow delete $workflow
if openstack cron trigger show publish-ui-logs-hourly &>/dev/null; then
openstack cron trigger delete publish-ui-logs-hourly
fi
#TODO In the future we should be able to run something like
# openstack workflow list --filter=tag=tripleo-common-managed
# but right now this is broken in Mistral, so we'll fix later.
for workflow in $(openstack workflow list -c Name -c Tags | grep tripleo-common-managed); do
NAME=$(echo ${workflow} | awk '{print $2}')
TAG=$(echo ${workflow} | awk '{print $4}')
if echo $TAG | grep -q tripleo-common-managed; then
openstack workflow delete $NAME
fi
done
for workbook in $(ls /usr/share/openstack-tripleo-common/workbooks/*); do
openstack workbook create $workbook
done
openstack cron trigger create publish-ui-logs-hourly tripleo.plan_management.v1.publish_ui_logs_to_swift --pattern '0 * * * *'
echo Mistral workbooks configured successfully.
# Store the SNMP password in a mistral environment
if ! openstack workflow env show tripleo.undercloud-config &>/dev/null; then
TMP_MISTRAL_ENV=$(mktemp)
echo "{\"name\": \"tripleo.undercloud-config\", \"variables\": {\"undercloud_ceilometer_snmpd_password\": \"$snmp_readonly_user_password\"}}" > $TMP_MISTRAL_ENV
echo Configure Mistral environment with undercloud-config
openstack workflow env create $TMP_MISTRAL_ENV
fi
fi
if [ "$(enable_validations)" = "true" ]; then
echo Execute copy_ssh_key validations
openstack workflow execution create tripleo.validations.v1.copy_ssh_key
fi
fi

View File

@ -47,6 +47,11 @@ parameters:
description: The user password for SNMPd with readonly rights running on all Overcloud nodes
type: string
hidden: true
EnableValidations:
default: false
description: >
Whether the TripleO validations are enabled.
type: boolean
conditions:
@ -78,6 +83,7 @@ resources:
- name: admin_password
- name: auth_url
- name: snmp_readonly_user_password
- name: enable_validations
config: {get_file: ./undercloud_post.sh}
UndercloudPostDeployment:
@ -97,6 +103,7 @@ resources:
homedir: {get_param: UndercloudHomeDir}
admin_password: {get_param: AdminPassword}
snmp_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
enable_validations: [get_params: EnableValidations]
# if SSL is enabled we use the public virtual ip as the stackrc endpoint
auth_url:
if: