RETIRED, A set of tools for Upgrading a TripleO environment
Go to file
Jose Luis Franco Arza 81035c28da Add new workarounds mechanism to apply workarounds via Ansible.
The tripleo-upgrade has a workarounds logic which allows us to
apply patches or specific modifications prior and after some of
the upgrade steps. However, if these workarouds need to be applied
in the overcloud nodes, the only way to do it was via a bash script
which would iterate over the nodes and apply the patch or perform a
change on each of the nodes.

This patch adds a new workarounds field: ansible_hosts. When this
option will be present in the workaround and it will be different
than an empty string then the workaround will be aplied via Ansible in
the nodes specified in that ansible_hosts field. This ansible_hosts
option needs to be used in combination with the command one, as
the command will be transformed in a shell Ansible task which will
be executed in the nodes passed in the ansible_hosts option.

Example:
pre_overcloud_upgrade_prepare_workarounds:
- set_root_password:
    patch: false
    basedir: ''
    id: ''
    ansible_hosts: 'overcloud'
    command: |
        echo redhat | passwd root --stdin

will turn into a set_root_password.yaml Ansible playbook under
~/ansible_workarounds:

cat ~/ansible_workarounds/set_root_password.yaml
- hosts: overcloud
  tasks:
    - name: set_root_password workaround
      shell: |
        echo redhat | passwd root --stdin

When executing the workarounds, a new bash function ansible_patch
has been included which will take care of executing the generated
Ansible playbook.

Also, an optional input parameter could be passed to workarounds.sh,
when passed, it will be taken as input for the --limit option when
executing ansible-playbook. This way, we can execute a workaround
specifically in a server, instead of running it in all of them.

Change-Id: I421ebecfc5504ac2fd225de0c4fb0cbf735bbdaf
(cherry picked from commit e582d2f304)
(cherry picked from commit b6bac90695)
2020-01-27 17:29:05 +01:00
ci-scripts Migrate linting to pre-commit 2018-12-24 16:22:23 +02:00
defaults Sync up upgrades and updates workarounds mechanism. 2019-11-25 14:43:31 +00:00
files RHOP 11 to 12 upgrade 2017-06-12 13:33:21 +02:00
handlers Add empty role structure 2017-05-31 16:28:55 +02:00
infrared_plugin Bump cirros version to 0.4.0 2019-11-21 14:45:26 +01:00
meta Address ansible-lint issues 2019-11-20 09:19:30 +01:00
releasenotes Update reno for stable/queens 2018-03-09 18:10:50 +00:00
tasks Merge "Update: Run all roles update at once" into stable/rocky 2019-12-17 20:39:18 +00:00
templates Add new workarounds mechanism to apply workarounds via Ansible. 2020-01-27 17:29:05 +01:00
tests Sync up upgrades and updates workarounds mechanism. 2019-11-25 14:43:31 +00:00
vars Move variables from vars to default 2017-06-23 10:35:52 +02:00
zuul.d [Configuration] Remove the build documentation. 2019-11-20 23:39:13 +01:00
.ansible-lint Migrate linting to pre-commit 2018-12-24 16:22:23 +02:00
.gitignore Setup tox 2017-12-06 14:02:27 -07:00
.gitreview Merge "Update .gitreview for stable/rocky" into stable/rocky 2019-06-12 05:41:20 +00:00
.pre-commit-config.yaml [rocky only] Change ansible-lint version to support py3.5. 2019-11-19 11:25:26 +01:00
.yamllint Migrate linting to pre-commit 2018-12-24 16:22:23 +02:00
LICENSE Initial commit 2017-05-31 15:43:01 +02:00
README.rst Bump cirros version to 0.4.0 2019-11-21 14:45:26 +01:00
ansible-requirements.txt Setup tox 2017-12-06 14:02:27 -07:00
ansible.cfg Add setuptools config files 2017-06-23 10:55:30 +02:00
requirements.txt Migrate linting to pre-commit 2018-12-24 16:22:23 +02:00
setup.cfg [Documentation] Migrate the format. 2019-11-20 23:39:19 +01:00
setup.py Add setuptools config files 2017-06-23 10:55:30 +02:00
test-requirements.txt [Configuration] Remove the build documentation. 2019-11-20 23:39:13 +01:00
tox.ini Replace git.openstack.org URLs with opendev.org URLs 2019-11-20 23:39:16 +01:00

README.rst

tripleo-upgrade

This role aims to provide a unified tool for upgrading TripleO based deploments.

Requirements

This role requires:

  • An ansible inventory file containing reacheable undercloud and overcloud nodes

  • Nodes in the inventory file are placed in groups based on their roles (e.g compute nodes are part of the 'compute' group)

  • Repositories containing packages to be upgraded are already installed on undercloud and overcloud nodes (or, for overcloud, define an upgrade_init_command variable)

  • The initial overcloud deploy command is placed in a script file located in the path set by the overcloud_deploy_script var. Each option/environment file should be placed on a separate new line, e.g:

    source ~/stackrc
    export THT=/usr/share/openstack-tripleo-heat-templates/
    
    openstack overcloud deploy --templates $THT \
    -r ~/openstack_deployment/roles/roles_data.yaml \
    -e $THT/environments/network-isolation.yaml \
    -e $THT/environments/network-management.yaml \
    -e $THT/environments/storage-environment.yaml \
    -e ~/openstack_deployment/environments/nodes.yaml \
    -e ~/openstack_deployment/environments/network-environment.yaml \
    -e ~/openstack_deployment/environments/disk-layout.yaml \
    -e ~/openstack_deployment/environments/neutron-settings.yaml \
    --log-file overcloud_deployment.log &> overcloud_install.log

Role Variables

Available variables are listed below:

upgrade_noop: false

Only create upgrade scripts without running them:

update_noop: false

Only create update scripts without running them:

undercloud_upgrade: false

Run undercloud upgrade:

containerized_undercloud_upgrade: false

Run containerized undercloud upgrade:

overcloud_upgrade: false

Run overcloud upgrade:

undercloud_update: false

Run undercloud update:

overcloud_update: false

Run overcloud update:

overcloud_deploy_script: "~/overcloud_deploy.sh"

Validate overcloud after update:

overcloud_images_validate: false

Location of the initial overcloud deploy script:

undercloud_upgrade_script: "~/undercloud_upgrade.sh"

Location of the undercloud upgrade script which is going to be generated by this role:

overcloud_composable_upgrade_script: "~/composable_docker_upgrade.sh"

Location of the upgrade script used in the composable docker upgrade step which is going to be generated by this role:

overcloud_converge_upgrade_script: "~/converge_docker_upgrade.sh"

Location of the upgrade script used in the converge docker upgrade step which is going to be generated by this role:

undercloud_rc: "~/stackrc"

Location of the undercloud credentials file:

overcloud_rc: "~/overcloudrc"

Location of the overcloud credentials file:

upgrade_workarounds: false

Allows the user to apply known issues workarounds during the upgrade process. The list of patches/commands used for workarounds should be passed via --extra-vars and it should include dictionaries for undercloud/overcloud workarounds:

use_oooq: false

Set to true when the deployment has been done by tripleo quickstart:

workload_launch: false

Set to true to launch an instance before starting upgrade. This can be useful for running tests during upgrade such as live migration or floating IP connectivity checks:

external_network_name: "public"

Name of the external network providing floating IPs for instance connectivity. This provides external connectivity and needs to exist beforehand, created by the user:

workload_image_url: "https://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img"

URL of the image used for the workload instance:

workload_memory: "512"

Amount of memory assigned for the workload instance:

tripleo_ci: false

Set to true when running the role in the TripleO CI jobs. It avoids losing connectivity to the undercloud by skipping reboot and ssh kill tasks:

upgrade_init_command: |
    sudo tripleo-repos -b pike current

Bash commands, defines a custom upgrade init to be taken into account during overcloud upgrade.

Dependencies

None.

Example Playbook

An example playbook is provided in tests/test.yml:

- hosts: undercloud
  gather_facts: true
  become: true
  become_method: sudo
  become_user: stack
  roles:
    - tripleo-upgrade

Usage with tripleo Quickstart

After a successful deployment with OOOQ, you can create the necessary scripts using this example playbook (duplicate from ./tests/oooq-test.yaml):

---
- hosts: undercloud
  gather_facts: true
  become: true
  become_method: sudo
  become_user: stack
  roles:
  - { role: tripleo-upgrade, use_oooq: 'true'}

And then you run it like this (adjust the paths to your oooq specific one):

ANSIBLE_SSH_ARGS="-F $(pwd)/ssh.config.ansible" \
  ANSIBLE_CONFIG=$PWD/ansible.cfg \
  ansible-playbook -i hosts -vvv tripleo-upgrade/tests/oooq-test.yaml
This will only create the file (without running the actual upgrade):
  • undercloud_upgrade.sh
  • composable_docker_upgrade.sh
  • overcloud-compute-*_upgrade_pre.sh
  • overcloud-compute-*_upgrade.sh
  • overcloud-compute-*_upgrade_post.sh
  • converge_docker_upgrade.sh

with the correct parameters.

Usage with InfraRed

tripleo-upgrade comes preinstalled as an InfraRed plugin. In order to install it manually, the following InfraRed command should be used:

infrared plugin add tripleo-upgrade
# add with a specific revision / branch
infrared plugin add --revision stable/pike tripleo-upgrade

After a successful InfraRed overcloud deployment you need to run the following steps to upgrade the deployment:

Symlink roles path:

ln -s $(pwd)/plugins $(pwd)/plugins/tripleo-upgrade/infrared_plugin/roles

Set up undercloud upgrade repositories:

infrared tripleo-undercloud \
    --upgrade yes \
    --mirror ${mirror_location} \
    --ansible-args="tags=upgrade_repos"

Set up undercloud update repositories:

infrared tripleo-undercloud \
    --update-undercloud yes \
    --mirror ${mirror_location} \
    --build latest \
    --version 12 \
    --ansible-args="tags=upgrade_repos"

Upgrade undercloud:

infrared tripleo-upgrade \
    --undercloud-upgrade yes

Update undercloud:

infrared tripleo-upgrade \
    --undercloud-update yes

Set up overcloud upgrade repositories:

infrared tripleo-overcloud \
    --deployment-files virt \
    --upgrade yes \
    --mirror ${mirror_location} \
    --ansible-args="tags=upgrade_collect_info,upgrade_repos"

Set up overcloud update repositories/containers:

infrared tripleo-overcloud \
    --deployment-files virt \
    --ocupdate True \
    --build latest \
    --ansible-args="tags=update_collect_info,update_undercloud_validation,update_repos,update_prepare_containers"

Upgrade overcloud:

infrared tripleo-upgrade \
    --overcloud-upgrade yes
Update overcloud::

infrared tripleo-upgrade --overcloud-update yes

Running the role manually from the undercloud

This role can be run manually from the undercloud by doing the following steps:

Note: before starting the upgrade process make sure that both the undercloud and overcloud nodes have the repositories with upgraded packages set up

Clone this repository

git clone https://opendev.org/openstack/tripleo-upgrade

Set ansible roles path::

ANSIBLE_ROLES_PATH=$(pwd)

Create inventory file::

printf "[undercloud]nlocalhost ansible_connection=local" > hosts

Run the playbook including this role::

ansible-playbook -i hosts tripleo-upgrade/tests/test.yml

License

BSD

Author Information

An optional section for the role authors to include contact information, or a website (HTML is not allowed).