|
329 | 329 | when: token_distributor is defined
|
330 | 330 | when: start_scylla_service is defined and start_scylla_service|bool
|
331 | 331 |
|
332 |
| -- name: Check if authentication is enabled |
| 332 | +- name: Check if authentication and audit are enabled |
333 | 333 | block:
|
334 | 334 | - command: cat /etc/scylla/scylla.yaml
|
335 | 335 | ignore_errors: true
|
|
342 | 342 | _authentication_enabled: |
|
343 | 343 | {% if (_scylla_yaml_map.authenticator is defined and (_scylla_yaml_map.authenticator == 'TransitionalAuthenticator' or _scylla_yaml_map.authenticator == 'PasswordAuthenticator')) or
|
344 | 344 | (_scylla_yaml_map.authorizer is defined and (_scylla_yaml_map.authorizer == 'TransitionalAuthorizer' or _scylla_yaml_map.authorizer == 'CassandraAuthorizer')) %}True{% else %}False{% endif %}
|
| 345 | + _audit_enabled: | |
| 346 | + {% if (_scylla_yaml_map.audit is defined and _scylla_yaml_map.audit == 'table') %}True{% else %}False{% endif %} |
345 | 347 | run_once: true
|
346 | 348 |
|
347 |
| -- name: If authentication is enabled, adjust replication for system_auth keyspace |
348 |
| - block: |
349 |
| - - name: Validate that all nodes are up before adjusting the replication |
350 |
| - uri: |
351 |
| - url: "http://{{ scylla_api_address }}:{{ scylla_api_port }}/failure_detector/endpoints/" |
352 |
| - follow_redirects: none |
353 |
| - method: GET |
354 |
| - register: _result |
355 |
| - until: _result.status == 200 |
356 |
| - retries: 10 |
357 |
| - delay: 1 |
358 |
| - |
359 |
| - - name: Get datacenter name |
360 |
| - uri: |
361 |
| - url: "http://{{ scylla_api_address }}:{{ scylla_api_port }}/snitch/datacenter" |
362 |
| - method: GET |
363 |
| - register: _datacenter_out |
364 |
| - until: _datacenter_out.status == 200 |
365 |
| - retries: 5 |
366 |
| - delay: 1 |
367 |
| - |
368 |
| - - name: Prepare per DC replication_factor list |
369 |
| - set_fact: |
370 |
| - dcs_to_rf: "{{ dcs_to_rf | default([]) + [\"'\" + hostvars[item]['_datacenter_out'].json + \"':\" + system_auth_rf|string] }}" |
371 |
| - loop: "{{ groups['scylla'] }}" |
372 |
| - run_once: true |
373 |
| - |
374 |
| - - name: Adjust replication for system_auth keyspace |
375 |
| - shell: | |
376 |
| - cqlsh {{ broadcast_address }} -u {{ cql_username }} -p {{ cql_password }} -e "ALTER KEYSPACE system_auth WITH replication = {'class': '{{ system_auth_replication_strategy }}', {{ dcs_to_rf | unique | join(',') }}};" |
377 |
| - run_once: true |
378 |
| - |
379 |
| - - name: Cleanup system_auth |
380 |
| - async_task: |
381 |
| - shell: | |
382 |
| - nodetool cleanup system_auth |
383 |
| - alias: scylla_cleanup_system_auth |
384 |
| - async: "{{ cleanup_timeout_seconds }}" |
385 |
| - retries: "{{ cleanup_timeout_seconds // 30 }}" # retries = cleanup_timeout_seconds / delay |
386 |
| - delay: 30 |
387 |
| - register: _cleanup_output |
388 |
| - |
389 |
| - - name: Cleanup logs |
390 |
| - debug: var=_cleanup_output |
391 |
| - |
392 |
| - - name: Repair system_auth |
393 |
| - include_tasks: repair.yml |
394 |
| - vars: |
395 |
| - keyspace: 'system_auth' |
| 349 | +- name: Adjust replication for system_auth keyspace |
| 350 | + include_tasks: adjust_keyspace_replication.yml |
| 351 | + vars: |
| 352 | + _keyspace: "system_auth" |
| 353 | + _keyspace_replication_strategy: "{{ system_auth_replication_strategy }}" |
| 354 | + _keyspace_rf: "{{ system_auth_rf }}" |
396 | 355 | when:
|
397 | 356 | - adjust_system_auth_replication is defined and adjust_system_auth_replication|bool
|
398 | 357 | - _authentication_enabled is defined and _authentication_enabled|bool
|
399 | 358 | - system_auth_rf is defined and system_auth_replication_strategy is defined
|
400 | 359 |
|
| 360 | +- name: Adjust replication for audit keyspace |
| 361 | + include_tasks: adjust_keyspace_replication.yml |
| 362 | + vars: |
| 363 | + _keyspace: "audit" |
| 364 | + _keyspace_replication_strategy: "{{ audit_replication_strategy }}" |
| 365 | + _keyspace_rf: "{{ audit_rf }}" |
| 366 | + when: |
| 367 | + - adjust_audit_replication is defined and adjust_audit_replication|bool |
| 368 | + - _audit_enabled is defined and _audit_enabled|bool |
| 369 | + - audit_rf is defined and audit_replication_strategy is defined |
| 370 | + |
401 | 371 | - name: generate monitoring configuration
|
402 | 372 | include_tasks: monitoring_config.yml
|
403 | 373 | when: generate_monitoring_config|bool
|
|
0 commit comments