Skip to content

Commit 486ba0e

Browse files
igorribeiroduartevladzcloudius
authored andcommitted
ansible-scylla-node: Use already existing io_properties.yaml and io.conf by default
Currently, by default, the role will always try to replace the io_properties.yaml and io.conf files according to scylla_io_setup output or pre-defined io_properties and io_conf variables. However, it makes more sense to avoid touching these files if they already exist, since the user might be, for example, performing some kind of test which requires io_properties/io.conf to use different values for different nodes. This patch changes the default behavior, and now these files will only be replaced if the flags `always_replace_io_properties` and `always_replace_io_conf', added on this patch, are set to True.
1 parent e5d7ab9 commit 486ba0e

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

ansible-scylla-node/defaults/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,14 @@ scylla_io_probe: True
201201
# and then the configuration files will be propagated for the other nodes of each datacenter.
202202
scylla_io_probe_dc_aware: False
203203

204+
# If set to True the content of io.conf is going to be aligned with the first node or the
205+
# first node in each DC (depending on the value of scylla_io_probe_dc_aware)
206+
always_replace_io_conf: False
207+
208+
# If set to True the content of io_properties.yaml is going to be aligned with the first node or the
209+
# first node in each DC (depending on the value of scylla_io_probe_dc_aware)
210+
always_replace_io_properties: False
211+
204212
# These can be arbitrarily set if scylla_io_probe is set to False
205213
# io_properties:
206214
# disks:

ansible-scylla-node/tasks/common.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,32 @@
7171
run_once: "{{ not scylla_io_probe_dc_aware|bool }}"
7272
become: true
7373

74+
- name: For every node, check if io.conf already exists and if it's not empty
75+
block:
76+
- stat:
77+
path: /etc/scylla.d/io.conf
78+
register: _io_conf_file
79+
80+
# During installation, scylla creates an io.conf filled only with comments and this file needs to be replaced
81+
- name: Check if file is empty or filled only with comments
82+
shell: "cat /etc/scylla.d/io.conf | grep -v ^#"
83+
register: _io_conf_out
84+
ignore_errors: true
85+
when: _io_conf_file.stat.exists|bool
86+
7487
- name: Set io.conf
7588
lineinfile:
7689
path: /etc/scylla.d/io.conf
7790
regexp: '^SEASTAR_IO='
7891
line: "{% if scylla_io_probe|bool and scylla_io_probe_dc_aware|bool %}{{ hostvars[dc_to_node_list[dc][0]]['io_conf'] }}{% else %}{{ io_conf }}{% endif %}"
7992
create: yes
8093
become: true
81-
when: io_conf is defined
94+
when: io_conf is defined and (_io_conf_file.stat.exists|bool == false or _io_conf_out.stdout|length == 0 or always_replace_io_conf|bool)
95+
96+
- name: For every node, check if io_properties.yaml already exists
97+
stat:
98+
path: /etc/scylla.d/io_properties.yaml
99+
register: _io_properties_file
82100

83101
- name: Set io_properties
84102
template:
@@ -88,6 +106,7 @@
88106
group: root
89107
mode: '0644'
90108
become: true
109+
when: _io_properties_file.stat.exists|bool == false or always_replace_io_properties|bool
91110

92111
- name: configure NTP
93112
shell: |

0 commit comments

Comments
 (0)