Skip to content

Commit 6369ed9

Browse files
committed
fix(roles/elasticsearch): assertions now run in separate block using 'always' tag, reformatted assertions
1 parent 378349e commit 6369ed9

1 file changed

Lines changed: 32 additions & 18 deletions

File tree

roles/elasticsearch/tasks/main.yml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,35 +103,49 @@
103103

104104
- name: 'ensure 0 <= elasticsearch__cluster_routing_allocation_disk_watermark_low <= 1'
105105
ansible.builtin.assert:
106-
that: >
107-
elasticsearch__cluster_routing_allocation_disk_watermark_low is number and
108-
elasticsearch__cluster_routing_allocation_disk_watermark_low >= 0 and
109-
elasticsearch__cluster_routing_allocation_disk_watermark_low <= 1
110-
fail_msg: 'elasticsearch__cluster_routing_allocation_disk_watermark_low must be a number between 0 and 1'
106+
that:
107+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_low is number'
108+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_low >= 0'
109+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_low <= 1'
110+
fail_msg: '`elasticsearch__cluster_routing_allocation_disk_watermark_low: {{ elasticsearch__cluster_routing_allocation_disk_watermark_low }}` must be a number between 0 and 1'
111111

112112
- name: 'ensure 0 <= elasticsearch__cluster_routing_allocation_disk_watermark_high <= 1'
113113
ansible.builtin.assert:
114-
that: >
115-
elasticsearch__cluster_routing_allocation_disk_watermark_high is number and
116-
elasticsearch__cluster_routing_allocation_disk_watermark_high >= 0 and
117-
elasticsearch__cluster_routing_allocation_disk_watermark_high <= 1
118-
fail_msg: 'elasticsearch__cluster_routing_allocation_disk_watermark_high must be a number between 0 and 1'
114+
that:
115+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_high is number'
116+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_high >= 0'
117+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_high <= 1'
118+
fail_msg: '`elasticsearch__cluster_routing_allocation_disk_watermark_high: {{ elasticsearch__cluster_routing_allocation_disk_watermark_high }}` must be a number between 0 and 1'
119119

120120
- name: 'ensure 0 <= elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage <= 1'
121121
ansible.builtin.assert:
122-
that: >
123-
elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage is number and
124-
elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage >= 0 and
125-
elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage <= 1
126-
fail_msg: 'elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage must be a number between 0 and 1'
122+
that:
123+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage is number'
124+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage >= 0'
125+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage <= 1'
126+
fail_msg: '`elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage: {{ elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage }}` must be a number between 0 and 1'
127+
128+
- name: 'ensure 0 <= elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage <= 1'
129+
ansible.builtin.assert:
130+
that:
131+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage is number'
132+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage >= 0'
133+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage <= 1'
134+
fail_msg: '`elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage: {{ elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage }}` must be a number between 0 and 1'
127135

128136
- name: 'ensure elasticsearch__cluster_routing_allocation_disk_watermark_low <= elasticsearch__cluster_routing_allocation_disk_watermark_high <= elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage'
129137
ansible.builtin.assert:
130-
that: >
131-
elasticsearch__cluster_routing_allocation_disk_watermark_low <= elasticsearch__cluster_routing_allocation_disk_watermark_high and
132-
elasticsearch__cluster_routing_allocation_disk_watermark_high <= elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage
138+
that:
139+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_low <= elasticsearch__cluster_routing_allocation_disk_watermark_high'
140+
- 'elasticsearch__cluster_routing_allocation_disk_watermark_high <= elasticsearch__cluster_routing_allocation_disk_watermark_flood_stage'
133141
fail_msg: 'elasticsearch__cluster_routing_allocation_disk_watermark_low must not exceed elasticsearch__cluster_routing_allocation_disk_watermark_high'
134142

143+
tags:
144+
- 'always'
145+
146+
147+
- block:
148+
135149
- name: 'deploy /etc/elasticsearch/elasticsearch.yml'
136150
ansible.builtin.template:
137151
backup: true

0 commit comments

Comments
 (0)