|
220 | 220 | register: logstash_writer_role_present
|
221 | 221 | run_once: true
|
222 | 222 |
|
223 |
| -- name: Put logstash_writer role into Elasticsearch |
| 223 | +# we doubled the task and didn't use a more sophisticated way to just change |
| 224 | +# the URI because we expect this task to be removed when ES 7 is out of |
| 225 | +# support |
| 226 | + |
| 227 | +- name: Put logstash_writer role into Elasticsearch < 8 |
224 | 228 | command: >
|
225 | 229 | curl -T /root/logstash_writer_role --header 'Content-Type: application/json'
|
226 | 230 | --cacert {{ elastic_ca_dir }}/ca.crt
|
227 | 231 | -u elastic:{{ elastic_password_logstash.stdout }}
|
228 | 232 | https://{{ elasticsearch_ca }}:9200/_xpack/security/role/logstash_writer
|
229 | 233 | delegate_to: "{{ elasticsearch_ca }}"
|
230 | 234 | run_once: true
|
231 |
| - when: logstash_writer_role_present.rc > 0 |
| 235 | + when: |
| 236 | + - logstash_writer_role_present.rc > 0 or logstash_reset_writer_role | bool |
| 237 | + - elastic_release | int < 8 |
| 238 | + |
| 239 | +- name: Put logstash_writer role into Elasticsearch > 7 |
| 240 | + command: > |
| 241 | + curl -T /root/logstash_writer_role --header 'Content-Type: application/json' |
| 242 | + --cacert {{ elastic_ca_dir }}/ca.crt |
| 243 | + -u elastic:{{ elastic_password_logstash.stdout }} |
| 244 | + https://{{ elasticsearch_ca }}:9200/_security/role/logstash_writer |
| 245 | + delegate_to: "{{ elasticsearch_ca }}" |
| 246 | + run_once: true |
| 247 | + when: |
| 248 | + - logstash_writer_role_present.rc > 0 or logstash_reset_writer_role | bool |
| 249 | + - elastic_release | int > 7 |
232 | 250 |
|
233 | 251 | - name: Check for logstash_writer user
|
234 | 252 | shell: >
|
|
242 | 260 | register: logstash_writer_user_present
|
243 | 261 | run_once: true
|
244 | 262 |
|
245 |
| -- name: Put logstash_writer user into Elasticsearch |
| 263 | +# we doubled the task and didn't use a more sophisticated way to just change |
| 264 | +# the URI because we expect this task to be removed when ES 7 is out of |
| 265 | +# support |
| 266 | + |
| 267 | +- name: Put logstash_writer user into Elasticsearch < 8 |
246 | 268 | command: >
|
247 | 269 | curl -T /root/logstash_writer_user --header 'Content-Type: application/json'
|
248 | 270 | --cacert {{ elastic_ca_dir }}/ca.crt
|
249 | 271 | -u elastic:{{ elastic_password_logstash.stdout }}
|
250 | 272 | https://{{ elasticsearch_ca }}:9200/_xpack/security/user/{{ logstash_user }}
|
251 | 273 | delegate_to: "{{ elasticsearch_ca }}"
|
252 | 274 | run_once: true
|
253 |
| - when: logstash_writer_user_present.rc > 0 |
| 275 | + when: |
| 276 | + - logstash_writer_user_present.rc > 0 |
| 277 | + - elastic_release | int < 8 |
| 278 | + |
| 279 | +- name: Put logstash_writer user into Elasticsearch > 7 |
| 280 | + command: > |
| 281 | + curl -T /root/logstash_writer_user --header 'Content-Type: application/json' |
| 282 | + --cacert {{ elastic_ca_dir }}/ca.crt |
| 283 | + -u elastic:{{ elastic_password_logstash.stdout }} |
| 284 | + https://{{ elasticsearch_ca }}:9200/_security/user/{{ logstash_user }} |
| 285 | + delegate_to: "{{ elasticsearch_ca }}" |
| 286 | + run_once: true |
| 287 | + when: |
| 288 | + - logstash_writer_user_present.rc > 0 |
| 289 | + - elastic_release | int > 7 |
0 commit comments