Browse Source

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
(cherry picked from commit 9164e6adbd)
(cherry picked from commit 5753352ee7)
changes/92/634892/2
Carlos Camacho 3 years ago
parent
commit
52be3ef9c1
  1. 21
      deployed-server/deployed-server.yaml
  2. 28
      puppet/role.role.j2.yaml
  3. 44
      puppet/services/tripleo-packages.yaml

21
deployed-server/deployed-server.yaml

@ -69,26 +69,6 @@ resources:
software_config_transport: {get_param: software_config_transport}
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:
type: OS::Heat::StructuredConfig
properties:
@ -102,7 +82,6 @@ resources:
name: InstanceIdDeployment
config: {get_resource: InstanceIdConfig}
server: {get_resource: deployed-server}
depends_on: UpgradeInitDeployment
HostsEntryConfig:
type: OS::Heat::SoftwareConfig

28
puppet/role.role.j2.yaml

@ -500,36 +500,8 @@ resources:
- {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:
type: OS::Heat::StructuredDeployment
depends_on: {{server_resource_name}}UpgradeInitDeployment
properties:
name: {{server_resource_name}}Deployment
config: {get_resource: {{server_resource_name}}Config}

44
puppet/services/tripleo-packages.yaml

@ -51,6 +51,20 @@ parameters:
echo "and passed the upstream name (ocata, pike, queens) of the release as first argument"
exit 1
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:
role_data:
@ -62,15 +76,29 @@ outputs:
step_config: |
include ::tripleo::packages
upgrade_tasks:
- name: Check yum for rpm-python present
- name: Package and repo update tasks
when: step|int == 0
yum: "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:
- step|int == 0
- rpm_python_check.changed != false
block:
- name: Run UpgradeInitCommand
shell:
list_join:
- ''
- - "#!/bin/bash\n\n"
- "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
- name: Check for os-net-config upgrade
shell: "yum check-upgrade | awk '/os-net-config/{print}'"
register: os_net_config_need_upgrade

Loading…
Cancel
Save