Skip to content

Commit

Permalink
CFME 5.9 to 5.10 migration Playbook (#45)
Browse files Browse the repository at this point in the history
* Added 5.10 migration playbook and modified configure-repositories.yml to support 5.10.

* Updated README.md and made additional modifications to configure_repositories.yml.

* Updated migrate-5-9-to-5-10 and configure-repositories with more changes during testing.

* Sourcing evm profile before running rake commands

* fixing various issues while testing 5.9 to 5.10 migration

* Adding better timeouts and retries to health check
  • Loading branch information
A-Beck authored Sep 18, 2019
1 parent ea1c5a4 commit 24dfbe8
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 7 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ Performs a migration from CFME 5.8 to 5.9 utilizing steps from [Migrating to Red
| sat6_org_id | No | | | Satellite 6 organization ID (when using activation key below)
| sat6_activation_key | No | | | Satellite 6 activation key (instead of direct subscribe to repos)

### migrate-5-9-to-5-10.yml
Performs a migration from CFME 5.9 to 5.10 utilizing steps from [Migrating to Red Hat CloudForms 4.7](https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.7/html/migrating_to_red_hat_cloudforms_4.7/). This playbook does not currently perform a backup, resize the disks or handle database replication scenarios.

#### Assumptions
* Appliances have already been backed up per [General Configuration Section 4.4.5.1](https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.5/html/general_configuration/configuration#backing-up-and-restoring-a-database).
* Disks have already been resized. (Only necessary if migrating from CFME 5.8.0.17 or earlier)
* Environments are not utilizing database replication.

#### Required groups
* cfme
* cfme-appliancees
* cfme-databases

#### Options
| parameter | required | default | choices | comments
|------------------------------|----------|---------|---------|-------------------------------------------------------------------
| cfme_additional_repositories | No | | | Additional repositories to configure when performing the migration
| sat6_org_id | No | | | Satellite 6 organization ID (when using activation key below)
| sat6_activation_key | No | | | Satellite 6 activation key (instead of direct subscribe to repos)

### rolling-update.yml
Performs an update/upgrade of all packages on the CFME appliances and performs a reboot if necessary.

Expand Down
113 changes: 113 additions & 0 deletions playbooks/migrate-5-9-to-5-10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
- name: CFME | Migrate | 5.9 to 5.10 | All Preparation
hosts: cfme
become: True
gather_facts: True
tasks:
- name: CFME | Migrate | Subscribe Using Activation Key
include_tasks: tasks/configure-activation-key.yml
when: sat6_activation_key is defined

- name: CFME | Migrate | Subscribe Using Repositories
include_tasks: tasks/configure-repositories.yml
vars:
cfme_version_product: '5.10'
when: sat6_activation_key is not defined

- name: CFME | Migrate | 5.9 to 5.10 | Appliances Specific Preparation
hosts: cfme-appliances
become: True
gather_facts: False
tasks:
- name: CFME | Migrate | Stop evmserverd
service:
name: evmserverd
state: stopped

- name: CFME | Migrate | 5.9 to 5.10 | DB Specific Preparation
hosts: cfme-databases
become: True
gather_facts: False
tasks:
- name: CFME | Migrate | Stop postgres
service:
name: rh-postgresql95-postgresql
state: stopped

- name: CFME | Migrate | 5.9 to 5.10 | Update Packages
hosts: cfme
become: True
gather_facts: False
tasks:
- name: CFME | Migrate | Update all packages to latest
yum:
name: '*'
state: latest

- name: CFME | Migrate | 5.9 to 5.10 | Start postgresql
hosts: cfme-databases
become: True
gather_facts: False
tasks:
- name: CFME | Migrate | Start postgres
service:
name: rh-postgresql95-postgresql
state: started

- name: CFME | Migrate | 5.9 to 5.10 | Wait for postgresql
hosts: cfme-databases
become: True
gather_facts: False
tasks:
- name: CFME | Migrate | Wait for postgresql
wait_for:
port: 5432
delay: 120

- name: CFME | Migrate | 5.9 to 5.10 | DB Migration
hosts: cfme-appliances
become: True
gather_facts: False
tasks:
- name: CFME | Migrate | rake db:migrate
run_once: True
shell: |-
source /etc/profile.d/evm.sh
cd /var/www/miq/vmdb
rake db:migrate > >(tee /var/tmp/rake_db_migrate.out) 2> >(tee /var/tmp/rake_db_migrate.err >&2)
async: 18000
poll: 60
args:
executable: /bin/bash

- name: CFME | Migrate | rake evm:automate:reset
run_once: True
shell: |-
source /etc/profile.d/evm.sh
cd /var/www/miq/vmdb
rake evm:automate:reset > >(tee /var/tmp/evm_automate_reset.out) 2> >(tee /var/tmp/evm_automate_reset.err >&2)
args:
executable: /bin/bash

- name: CFME | Migrate | 5.9 to 5.10 | Post DB Migrate Restart
hosts: cfme-databases
become: True
gather_facts: False
tasks:
- name: CFME | Migrate | Restart postgresql
service:
name: rh-postgresql95-postgresql
state: restarted

- name: CFME | Migrate | 5.9 to 5.10 | Restart evmserverd
hosts: cfme-appliances
become: True
gather_facts: False
tasks:
- name: CFME | Migrate | Restart evmserverd
service:
name: evmserverd
state: restarted

- name: CFME | Migrate | 5.9 to 5.10 | Wait for API to report ready
import_playbook: health-check.yml
18 changes: 18 additions & 0 deletions playbooks/rolling-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,21 @@
- name: CFME | Rolling Update | Include Tasks for Updating Packages
include_tasks: tasks/update-packages.yml
when: packages_need_update_result is changed

- name: CFME | Rolling Update | Wait for API to report ready
import_playbook: health-check.yml

- name: CFME | Rolling Update | Reset MIQ and Red Hat Automate Domains
hosts: cfme-appliances
become: True
gather_facts: False
tasks:

- name: CFME | Rolling Update | rake evm:automate:reset
run_once: True
shell: |-
source /etc/profile.d/evm.sh
cd /var/www/miq/vmdb
rake evm:automate:reset > >(tee /var/tmp/evm_automate_reset.out) 2> >(tee /var/tmp/evm_automate_reset.err >&2)
args:
executable: /bin/bash
17 changes: 16 additions & 1 deletion playbooks/simultaneous-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,20 @@
include_tasks: tasks/update-packages.yml
when: packages_need_update_result | changed

- name: CFME | Update | wait for API to report ready
- name: CFME | Update | Wait for API to report ready
import_playbook: health-check.yml

- name: CFME | Update | Reset MIQ and Red Hat Automate Domains
hosts: cfme-appliances
become: True
gather_facts: False
tasks:

- name: CFME | Update | rake evm:automate:reset
run_once: True
shell: |-
source /etc/profile.d/evm.sh
cd /var/www/miq/vmdb
rake evm:automate:reset > >(tee /var/tmp/evm_automate_reset.out) 2> >(tee /var/tmp/evm_automate_reset.err >&2)
args:
executable: /bin/bash
15 changes: 13 additions & 2 deletions tasks/configure-repositories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,25 @@
cfme_version_product: "{{ ansible_local['cfme']['cfme_version_product'] }}"
when: cfme_version_product is not defined

- name: CFME | Configure Repositories | Set Required Repositories
- name: CFME | Configure Repositories | Set Required Base Repositories
set_fact:
cfme_repositories:
cfme_base_repositories:
- rhel-7-server-rpms
- rhel-server-rhscl-7-rpms
- rhel-7-server-extras-rpms
- "cf-me-{{ cfme_version_product }}-for-rhel-7-rpms"

- name: CFME | Configure Repositories | Set Version Specific Repositories
set_fact:
cfme_version_repositories:
- rhel-7-server-ansible-2.7-rpms
- rhel-7-server-rh-common-rpms
when: cfme_version_product == '5.10'

- name: CFME | Configure Repositories | Set Required Repositories
set_fact:
cfme_repositories: "{{ cfme_base_repositories | union ( cfme_version_repositories if cfme_version_product == '5.10' else [] ) }}"

- name: CFME | Configure Repositories | Enable Required Repositories
command: "subscription-manager repos --enable='{{ item }}'"
with_items: "{{ cfme_repositories }}"
Expand Down
7 changes: 3 additions & 4 deletions tasks/perform-health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
host: "{{ ansible_fqdn }}"
port: 443
state: started
timeout: 60
timeout: "{{ cfme_port_ready_timeout_seconds | default(600) }}"

- name: CFME | Health Check | Ping Check
local_action:
module: uri
uri:
url: "https://{{ ansible_fqdn }}:443/ping"
method: GET
validate_certs: False
body_format: raw
return_content: Yes
register: cfme_ping_check_result
until: "cfme_ping_check_result['content'] is defined and cfme_ping_check_result['content'] == 'pong'"
retries: 60
retries: "{{ cfme_healthcheck_retries | default(100) }}"
delay: 5

0 comments on commit 24dfbe8

Please sign in to comment.