Move UpgradeInitCommand and UpgradeInitCommonCommand to run by Ansible

This change moves the execution of UpgradeInitCommand
and UpgradeInitCommonCommand to be executed with
Ansible in the upgrade step 0 instead of Heat.

Closes-bug: 1812659
Change-Id: I76eb6a2572e24b6f114e38897a68cd85276af3c6
This commit is contained in:
Carlos Camacho 2019-01-21 16:05:58 +01:00
parent 55e7174e41
commit 9164e6adbd
3 changed files with 36 additions and 57 deletions

View File

@ -69,26 +69,6 @@ resources:
software_config_transport: {get_param: software_config_transport} software_config_transport: {get_param: software_config_transport}
deployment_swift_data: {get_param: deployment_swift_data} deployment_swift_data: {get_param: deployment_swift_data}
UpgradeInitConfig:
type: OS::Heat::SoftwareConfig
properties:
group: script
config:
list_join:
- ''
- - "#!/bin/bash\n\n"
- "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
- get_param: UpgradeInitCommand
- get_param: UpgradeInitCommonCommand
UpgradeInitDeployment:
type: OS::Heat::SoftwareDeployment
properties:
name: UpgradeInitDeployment
server: {get_resource: deployed-server}
config: {get_resource: UpgradeInitConfig}
InstanceIdConfig: InstanceIdConfig:
type: OS::Heat::StructuredConfig type: OS::Heat::StructuredConfig
properties: properties:
@ -102,7 +82,6 @@ resources:
name: InstanceIdDeployment name: InstanceIdDeployment
config: {get_resource: InstanceIdConfig} config: {get_resource: InstanceIdConfig}
server: {get_resource: deployed-server} server: {get_resource: deployed-server}
depends_on: UpgradeInitDeployment
HostsEntryConfig: HostsEntryConfig:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig

View File

@ -51,6 +51,20 @@ parameters:
echo "and passed the upstream name (ocata, pike, queens) of the release as first argument" echo "and passed the upstream name (ocata, pike, queens) of the release as first argument"
exit 1 exit 1
type: string type: string
UpgradeInitCommand:
type: string
description: |
Command or script snippet to run on all overcloud nodes to
initialize the upgrade process. E.g. a repository switch.
default: ''
UpgradeInitCommonCommand:
type: string
description: |
Common commands required by the upgrades process. This should not
normally be modified by the operator and is set and unset in the
major-upgrade-composable-steps.yaml and major-upgrade-converge.yaml
environment files.
default: ''
outputs: outputs:
role_data: role_data:
@ -62,15 +76,29 @@ outputs:
step_config: | step_config: |
include ::tripleo::packages include ::tripleo::packages
upgrade_tasks: upgrade_tasks:
- name: Check yum for rpm-python present - name: Package and repo update tasks
when: step|int == 0 when: step|int == 0
package: "name=rpm-python state=present" block:
register: rpm_python_check - name: Run UpgradeInitCommand
- name: Fail when rpm-python wasn't present shell:
fail: msg="rpm-python package was not present before this run! Check environment before re-running" list_join:
when: - ''
- step|int == 0 - - "#!/bin/bash\n\n"
- rpm_python_check.changed != false - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
- {get_param: UpgradeInitCommand}
- name: Run UpgradeInitCommonCommand
shell:
list_join:
- ''
- - "#!/bin/bash\n\n"
- {get_param: UpgradeInitCommonCommand}
- name: Check yum for rpm-python present
package: "name=rpm-python state=present"
register: rpm_python_check
- name: Fail when rpm-python wasn't present
fail: msg="rpm-python package was not present before this run! Check environment before re-running"
when:
- rpm_python_check.changed != false
# With the layered product packaging, the key package is rhosp-openvswitch. It depends on # With the layered product packaging, the key package is rhosp-openvswitch. It depends on
# a openvswitch package that includes the version as part of the name (e.g openvswitch2.10). # a openvswitch package that includes the version as part of the name (e.g openvswitch2.10).
# This requires some additional special handling: # This requires some additional special handling:

View File

@ -630,36 +630,8 @@ resources:
- {get_param: NetworkDeploymentActions} - {get_param: NetworkDeploymentActions}
- [] - []
{{server_resource_name}}UpgradeInitConfig:
type: OS::Heat::SoftwareConfig
properties:
group: script
config:
list_join:
- ''
- - "#!/bin/bash\n\n"
- "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
- get_param: UpgradeInitCommand
- get_param: UpgradeInitCommonCommand
# Note we may be able to make this conditional on UpgradeInitCommandNotEmpty
# but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first
{{server_resource_name}}UpgradeInitDeployment:
type: OS::Heat::SoftwareDeployment
depends_on: NetworkDeployment
properties:
name: {{server_resource_name}}UpgradeInitDeployment
server: {get_resource: {{server_resource_name}}}
config: {get_resource: {{server_resource_name}}UpgradeInitConfig}
actions:
if:
- server_not_blacklisted
- ['CREATE', 'UPDATE']
- []
{{server_resource_name}}Deployment: {{server_resource_name}}Deployment:
type: OS::Heat::StructuredDeployment type: OS::Heat::StructuredDeployment
depends_on: {{server_resource_name}}UpgradeInitDeployment
properties: properties:
name: {{server_resource_name}}Deployment name: {{server_resource_name}}Deployment
config: {get_resource: {{server_resource_name}}Config} config: {get_resource: {{server_resource_name}}Config}