Skip to content

Commit 4e4c1d8

Browse files
committed
scylla role: support for 2022.2 (5.0)
1 parent 8191e71 commit 4e4c1d8

File tree

5 files changed

+113
-49
lines changed

5 files changed

+113
-49
lines changed

ansible-scylla-node/meta/main.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@ galaxy_info:
99
description: Scylla node role
1010
company: "ScyllaDB.com"
1111
license: "license (Apache)"
12-
min_ansible_version: 2.8.0
12+
min_ansible_version: 6.7.0
1313
platforms:
1414
- name: EL
1515
versions:
1616
- 7
1717
- name: Debian
1818
versions:
19-
- 8
2019
- 9
2120
- name: Ubuntu
2221
versions:
2322
- 20.04
24-
- 16.04
25-
- 18.04
2623
- galaxy_tags:
2724
- scylla
2825
- scylladb

ansible-scylla-node/tasks/Debian_install.yml

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,30 @@
22
# Requires a 'scylla_version_to_install' fact to be set to a version string we want to install
33
- name: Install Scylla
44
block:
5-
- name: Install 'latest' Scylla
5+
6+
- name: Install 'latest' {{ scylla_edition }} Scylla
67
block:
78
- block:
8-
- name: Nuke an OSS pin file if exists
9+
- name: Nuke an {{ scylla_edition }} pin file if exists
910
file:
1011
state: absent
11-
path: /etc/apt/preferences.d/99-scylla
12+
path: "/etc/apt/preferences.d/99-{{ scylla_package_prefix }}"
1213

13-
- name: Install latest OSS Scylla
14+
- name: Install latest {{ scylla_edition }} Scylla
1415
apt:
15-
name: scylla
16+
name: "{{ scylla_package_prefix }}"
1617
state: latest
17-
when: scylla_edition == 'oss'
18-
19-
- block:
20-
- name: Nuke an Enterprise pin file if exists
21-
file:
22-
state: absent
23-
path: /etc/apt/preferences.d/99-scylla-enterprise
2418

25-
- name: Install latest Enterprise Scylla
19+
- name: Install latest {{ scylla_edition }} Scylla machine image
2620
apt:
27-
name: scylla-enterprise
21+
name: "{{ scylla_package_prefix }}-machine-image"
2822
state: latest
29-
when: scylla_edition == 'enterprise'
23+
3024
when: scylla_version_to_install == 'latest'
3125

3226
### Handle non-latest version installation
3327
- name: Install explicitly specified Scylla version
3428
block:
35-
- name: Set Scylla package prefix as OSS
36-
set_fact:
37-
scylla_package_prefix: "scylla"
38-
when: scylla_edition == 'oss'
39-
40-
- name: Set Scylla package prefix as Enterprise
41-
set_fact:
42-
scylla_package_prefix: "scylla-enterprise"
43-
when: scylla_edition == 'enterprise'
4429

4530
- name: Get versions of {{ scylla_edition }} package
4631
# 'apt list -a' output has a package version as a second column and an arch as a third one.
@@ -57,7 +42,7 @@
5742

5843
- name: "Validate scylla version correctness"
5944
ansible.builtin.fail:
60-
msg: "Too many/few choices for a requested version '{{ scylla_version_to_install }}': {{ aptversions.stdout_lines }}. Bailing out!"
45+
msg: "Too many/few choices for a requested version '{{ scylla_version_to_install }}': {{ aptversions.stdout_lines }}. Fix your Scylla scylla_version or scylla_deb_repos/scylla_repo_keys!"
6146
when: aptversions.stdout_lines | length != 1
6247

6348
- name: Fetch version parts of Scylla package
@@ -75,10 +60,47 @@
7560
group: root
7661
mode: '0644'
7762

78-
- name: "Install {{ aptversions.stdout }}"
63+
- name: "Install {{ aptversions.stdout }} {{ scylla_edition }}"
7964
apt:
8065
name: "{{ scylla_package_prefix }}={{ aptversions.stdout }}"
8166
state: present
8267
allow_downgrade: yes
68+
69+
70+
# strip scylla_version_to_install off the last .XXX only to format 2022.2.0-20230112
71+
72+
# scylla:
73+
# 2022.2.0-0.20230112.4f0f82ff2e1d-1
74+
# scylla machine image:
75+
# 2022.2.0-20230112.1239c34-1
76+
77+
- name: Get versions of {{ scylla_edition }} machine image package
78+
# 'apt list -a' output has a package version as a second column and an arch as a third one.
79+
# Let's filter by the arch first and then cut the version column.
80+
# Then we will filter out all rows that start with a requested version string followed by a digit to filter out version like 2021.1.11 when 2021.1.1 was requested.
81+
# And finally, we are going to get rid of duplications.
82+
shell: apt list -a {{ scylla_package_prefix }}-machine-image 2>/dev/null | awk '{split($0,a," "); print a[2]}' | egrep "^{{ stripped_scylla_machine_image_version_escaped }}" | sort | uniq
83+
register: aptversions_machine_image
84+
vars:
85+
stripped_scylla_machine_image_version_escaped: "{{ scylla_version_split[0][0] | regex_escape }}\\-"
86+
87+
- name: "Validate scylla version correctness"
88+
ansible.builtin.fail:
89+
msg: "Too many/few choices for a requested version '{{ stripped_scylla_machine_image_version_escaped }}': {{ aptversions_machine_image.stdout_lines }}. Fix your Scylla scylla_version or scylla_deb_repos/scylla_repo_keys!"
90+
when: aptversions_machine_image.stdout_lines | length != 1
91+
92+
- name: Fetch version parts of Scylla package
93+
set_fact:
94+
scylla_machine_image_version_split: "{{ aptversions_machine_image.stdout | regex_findall(regexp, ignorecase=True) }}"
95+
vars:
96+
# All we know that the version is a string comprised of 3 parts separated by '-'
97+
regexp: '^([^\-]+)-([^\-]+)-([^\-]+)$'
98+
99+
- name: "Install {{ aptversions_machine_image.stdout }} {{ scylla_edition }} machine image"
100+
apt:
101+
name: "{{ scylla_package_prefix }}-machine-image={{ aptversions_machine_image.stdout }}*"
102+
state: latest
103+
allow_downgrade: yes
104+
83105
when: scylla_version_to_install != 'latest'
84106
become: true

ansible-scylla-node/tasks/RedHat.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,36 @@
8282
when: item.split(".")[-1] == "repo"
8383
become: true
8484

85-
- name: Install Scylla
85+
- name: Install {{ scylla_edition }}
8686
block:
87-
- name: Install latest OSS Scylla
87+
- name: Install latest {{ scylla_edition }} Scylla
8888
yum:
89-
name: scylla
89+
name: "{{ scylla_package_prefix }}"
9090
state: latest
9191
lock_timeout: 60
92-
when: scylla_version == 'latest' and scylla_edition == 'oss'
92+
when: scylla_version == 'latest'
9393

94-
- name: Install latest Enterprise Scylla
94+
- name: Install latest {{ scylla_edition }} Scylla machine image
9595
yum:
96-
name: scylla-enterprise
96+
name: "{{ scylla_package_prefix }}-machine-image"
9797
state: latest
98-
when: scylla_version == 'latest' and scylla_edition == 'enterprise'
98+
lock_timeout: 60
99+
when: scylla_version == 'latest'
99100

100-
- name: Install specified OSS Scylla
101+
- name: Install specified {{ scylla_edition }} Scylla
101102
yum:
102-
name: "scylla-{{ scylla_version }}"
103+
name: "{{ scylla_package_prefix }}-{{ scylla_version }}"
103104
state: present
104105
lock_timeout: 60
105-
when: scylla_version != 'latest' and scylla_edition == 'oss'
106+
when: scylla_version != 'latest'
106107

107-
- name: Install specified Enterprise Scylla
108+
- name: Install specified {{ scylla_edition }} Scylla machine image
108109
yum:
109-
name: "scylla-enterprise-{{ scylla_version }}"
110+
name: "{{ scylla_package_prefix }}-machine-image-{{ scylla_version }}"
110111
state: present
111112
lock_timeout: 60
112-
when: scylla_version != 'latest' and scylla_edition == 'enterprise'
113+
when: scylla_version != 'latest'
114+
113115
become: true
114116

115117
- name: Configure SELinux

ansible-scylla-node/tasks/common.yml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@
4242

4343
- name: Collect IO settings for the first node of every DC
4444
block:
45+
- name: check for existing io_properties for cloud run
46+
stat:
47+
path: /etc/scylla.d/io_properties.yaml
48+
register: io_prop_cloud_stat
49+
50+
- name: check for scylla_cloud_io_setup
51+
stat:
52+
path: /opt/scylladb/scylla-machine-image/scylla_cloud_io_setup
53+
register: io_cloud_setup
54+
55+
- name: Run cloud IO setup
56+
shell: |
57+
/opt/scylladb/scylla-machine-image/scylla_cloud_io_setup
58+
become: true
59+
# if above is not found leverage /opt/scylladb/python3/bin/python3 /opt/scylladb/scylla-machine-image/lib/scylla_cloud_io_setup.py ?
60+
# or provide our own role runner for pre 2022.2.1 ?
61+
when: (scylla_raid_setup is defined) and (scylla_raid_setup|length > 0) and (io_cloud_setup.stat.exists) and (io_prop_stat.stat.exists|bool == False)
62+
# we should maybe add a better way how to detect if this is cloud and run it, otherwise fallback to below (though above should fall back to it too, but it was broken in early 2022.1 and 2022.2.0)
63+
4564
- name: check for existing io_properties
4665
stat:
4766
path: /etc/scylla.d/io_properties.yaml
@@ -95,23 +114,37 @@
95114
become: true
96115
when: skip_ntp is defined and skip_ntp|bool == false
97116

117+
- name: check for node_exporter_install
118+
stat:
119+
path: /usr/sbin/node_exporter_install
120+
register: node_exporter_install
121+
98122
- name: node exporter setup
99123
shell: |
100124
node_exporter_install --force
101-
when: install_type == 'online'
125+
when: (install_type == 'online') and (node_exporter_install.stat.exists)
102126
become: true
103127
notify:
104128
- node_exporter start
105-
ignore_errors: true
106-
#TODO: stop ignoring errors when the node_exporter_install script fix is available in all actual versions, resp. use only for < 5.0 / 2022
129+
130+
- name: check for node_exporter
131+
stat:
132+
path: /opt/scylladb/node_exporter/node_exporter
133+
register: node_exporter
107134

108135
- name: node exporter setup from 5.0/2022
109-
service:
136+
block:
137+
- name: Enforce disabling of old node exporter
138+
service:
139+
name: node-exporter
140+
state: stopped
141+
ignore_errors: true
142+
- name: Start bundled node exporter
143+
service:
110144
name: scylla-node-exporter
111145
state: started
112146
become: true
113-
ignore_errors: true
114-
#TODO: stop ignoring errors when a version check is added
147+
when: node_exporter.stat.exists
115148

116149
- name: configure Scylla
117150
shell: |

ansible-scylla-node/tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
package_facts:
99
manager: auto
1010

11+
- name: Set Scylla package prefix as OSS
12+
set_fact:
13+
scylla_package_prefix: "scylla"
14+
when: scylla_edition == 'oss'
15+
16+
- name: Set Scylla package prefix as Enterprise
17+
set_fact:
18+
scylla_package_prefix: "scylla-enterprise"
19+
when: scylla_edition == 'enterprise'
20+
1121
# Upgrade
1222
- name: Upgrade Scylla
1323
include_tasks: upgrade/main.yml

0 commit comments

Comments
 (0)