Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible-scylla-node: prevent minor upgrade from failing when the destination scylla version is already installed #416

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions ansible-scylla-node/tasks/upgrade/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@
is_scylla_installed: "{{ is_oss_installed or is_enterprise_installed }}"
edition_installed: "{{ 'oss' if is_oss_installed else 'enterprise' }}"
package_installed: "{{ 'scylla' if is_oss_installed else 'scylla-enterprise' }}"
full_version: "{{ ansible_facts.packages[package_installed][0].version }}"
full_version_split: "{{ (full_version.split('-')[0]).split('.') }}"
ansible.builtin.set_fact:
scylla_detected: {
edition: "{{ edition_installed }}",
edition_friendly_name: "{{ 'Open Source' if is_oss_installed else 'Enterprise' }}",
package_name: "{{ package_installed }}",
version: "{{ ansible_facts.packages[package_installed][0].version }}",
major_version: "{{ (ansible_facts.packages[package_installed][0].version).split('.')[0] }}.{{ (ansible_facts.packages[package_installed][0].version).split('.')[1] }}"
version: "{{ full_version_split[0] }}.{{ full_version_split[1] }}.{{ full_version_split[2] }}",
major_version: "{{ full_version_split[0] }}.{{ full_version_split[1] }}"
}
when: is_scylla_installed

Expand All @@ -125,18 +127,19 @@


# Scylla upgrade information
# ----- TODO: CHANGE THIS TASK TO ALLOW 'latest' FOR MINOR UPGRADES -----
- name: Gather information about Scylla upgrade
vars:
is_oss_selected: "{{ true if scylla_edition == 'oss' else false }}"
final_version: "{{ scylla_version if scylla_version != 'latest' else scylla_support[ansible_facts['distribution'] |lower][ansible_facts['distribution_major_version']][scylla_edition] |first }}"
final_version: "{{ scylla_version_to_install }}"
final_version_split: "{{ (final_version.split('-')[0]).split('.') }}"
ansible.builtin.set_fact:
# If this fact should be updated later, it should be updated entirely due to its structure
scylla_upgrade: {
edition: "{{ scylla_edition }}",
edition_friendly_name: "{{ 'Open Source' if is_oss_selected else 'Enterprise' }}",
version: "{{ final_version }}",
major_version: "{{ final_version.split('.')[0] }}.{{ final_version.split('.')[1] }}",
full_version: "{{ final_version }}",
version: "{{ final_version_split[0] }}.{{ final_version_split[1] }}.{{ final_version_split[2] }}",
major_version: "{{ final_version_split[0] }}.{{ final_version_split[1] }}",
id: "{{ ansible_date_time.epoch }}",
upgrade: true
}
Expand All @@ -145,11 +148,10 @@
# Scylla version validation
- name: Check if Scylla version was specified incorrectly
vars:
version_format: "{{ 'X.Y.Z' if scylla_upgrade['edition'] else 'UVWX.Y.Z' }}"
version_format: "{{ 'X.Y.Z' if scylla_upgrade['edition'] == 'oss' else 'UVWX.Y.Z' }}"
ansible.builtin.fail:
msg: "Version {{ scylla_upgrade['version'] }} specified for Scylla {{ scylla_upgrade['edition_friendly_name'] }} is incomplete and can't be used for a minor upgrade. Version format is: '{{ version_format }}'."
when:
- scylla_version != 'latest'
- scylla_upgrade['version'] == scylla_upgrade['major_version']
- not upgrade_major

Expand Down Expand Up @@ -281,10 +283,6 @@
# Upgrade verification
- name: Upgrade verification
block:
- name: "Wait {{ upgrade_break_before_verification }} seconds before verifying the upgrade"
ansible.builtin.wait_for:
timeout: "{{ upgrade_break_before_verification |int }}"

- name: Verify if the upgrade was done sucessfully
include_tasks: node_verification.yml
rescue:
Expand All @@ -303,9 +301,6 @@
ansible.builtin.wait_for:
timeout: "{{ upgrade_break_before_verification |int }}"

- name: Verify if the upgrade was done sucessfully
- name: Verify if the upgrade was done successfully
include_tasks: node_verification.yml


# ----- TODO: If the upgrade version is the latest one and if 'latest' was used to specify the version
# replace upgrade version with latest
5 changes: 5 additions & 0 deletions ansible-scylla-node/tasks/upgrade/post_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
notify: scylla-manager-agent restart
become: true

- name: Wait for CQL port
wait_for:
port: 9042
host: "{{ scylla_listen_address }}"

Loading