Skip to content

Commit

Permalink
Update ocp-upgrade playbook
Browse files Browse the repository at this point in the history
Fixes: ocp-power-automation#43
Signed-off-by: Prajyot Parab <prajyot.parab@ibm.com>
  • Loading branch information
Prajyot-Parab authored and yussufsh committed Aug 7, 2020
1 parent ac466c9 commit 9cfd3b3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
3 changes: 2 additions & 1 deletion examples/upgrade_vars.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
upgrade_image: "" #OCP upgrade image
upgrade_version: "" #OCP upgrade version eg. 4.5.4
upgrade_channel: "" #OCP channel having required upgrade version available for cluster upgrade (stable-4.x, fast-4.x, candidate-4.x) eg. stable-4.5
pause_time: 90 #Pauses playbook execution for a set amount of time in minutes
delay_time: 600 #Number of seconds to wait before starting to poll

13 changes: 7 additions & 6 deletions playbooks/roles/ocp-upgrade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ Requirements
Role Variables
--------------

| Variable | Required | Default | Comments |
|---------------|----------|---------|---------------------------------------------------------------|
| upgrade_image | no | "" | OCP upgrade image |
| pause_time | no | 90 | Pauses playbook execution for a set amount of time in minutes |
| delay_time | no | 600 | Number of seconds to wait before starting to poll |
| Variable | Required | Default | Comments |
|-----------------|----------|------------|---------------------------------------------------------------|
| upgrade_version | no | "" | Set to a specific version eg. 4.5.4 |
| upgrade_channel | no | "" | Set to channel having required upgrade version available for cluster upgrade (stable-4.x, fast-4.x, candidate-4.x) eg. stable-4.5 |
| pause_time | no | 90 | Pauses playbook execution for a set amount of time in minutes |
| delay_time | no | 600 | Number of seconds to wait before starting to poll |

Dependencies
------------
Expand All @@ -30,7 +31,7 @@ Example Playbook
tasks:
- include_role:
name: ocp-upgrade
when: upgrade_image!= ""
when: upgrade_version != ""

License
-------
Expand Down
3 changes: 2 additions & 1 deletion playbooks/roles/ocp-upgrade/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
# defaults file

upgrade_image: ""
upgrade_version: ""
upgrade_channel: ""
pause_time: 90
delay_time: 600

7 changes: 6 additions & 1 deletion playbooks/roles/ocp-upgrade/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---

- name: Set upgrade channel
when: upgrade_channel != ""
shell: |
oc patch clusterversion/version -p '{"spec":{"channel":"{{ upgrade_channel }}"}}' --type=merge
- name: Upgrade cluster
shell: |
oc adm upgrade --force --to-image="{{ upgrade_image }}" --allow-explicit-upgrade
oc adm upgrade --to="{{ upgrade_version }}"
- name: Waiting until upgrade completes
pause:
Expand Down
2 changes: 1 addition & 1 deletion playbooks/upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
tasks:
- include_role:
name: ocp-upgrade
when: upgrade_image!= ""
when: upgrade_version != ""

0 comments on commit 9cfd3b3

Please sign in to comment.