This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathconverge.yml
99 lines (92 loc) · 3.53 KB
/
converge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
- name: Example Playbook for the locp.cassandra Role
hosts: cassandra
remote_user: root
vars:
cassandra_configuration:
authenticator: PasswordAuthenticator
cluster_name: MyCassandraCluster
commitlog_directory: /data/cassandra/commitlog
commitlog_sync: periodic
commitlog_sync_period_in_ms: 10000
data_file_directories:
- /data/cassandra/data
endpoint_snitch: GossipingPropertyFileSnitch
hints_directory: "/data/cassandra/hints"
listen_address: "{{ ansible_default_ipv4.address }}"
# For a sensible value to set num_tokens to, please see
# https://cassandra.apache.org/doc/latest/getting_started/production.html#tokens
num_tokens: 4
partitioner: org.apache.cassandra.dht.Murmur3Partitioner
saved_caches_directory: /data/cassandra/saved_caches
seed_provider:
- class_name: "org.apache.cassandra.locator.SimpleSeedProvider"
parameters:
# This sets the seed to the first node in the Ansible group called
# cassandra.
- seeds: "{{ hostvars[groups['cassandra'][0]]['ansible_default_ipv4'].address }}"
start_native_transport: true
cassandra_configure_apache_repo: true
# Create an alternative directories structure for the Cassandra data.
# In this example, the will be a directory called /data owned by root
# with rwxr-xr-x permissions. It will have a series of sub-directories
# all of which will be defaulted to being owned by the cassandra user
# with rwx------ permissions.
cassandra_directories:
root:
group: root
mode: "0755"
owner: root
paths:
- /data
data:
paths:
- /data/cassandra
- /data/cassandra/commitlog
- /data/cassandra/data
- /data/cassandra/hints
- /data/cassandra/saved_caches
cassandra_regex_replacements:
- path: cassandra-env.sh
line: 'MAX_HEAP_SIZE="{{ cassandra_max_heapsize_mb }}M"'
regexp: '^#MAX_HEAP_SIZE="4G"'
- path: cassandra-env.sh
line: 'HEAP_NEWSIZE="{{ cassandra_heap_new_size_mb }}M"'
regexp: '^#HEAP_NEWSIZE="800M"'
- path: cassandra-rackdc.properties
line: 'dc=DC1'
regexp: '^dc='
- path: cassandra-rackdc.properties
line: 'rack=RACK1'
regexp: '^rack='
cassandra_repo_apache_release: 40x
roles:
- role: locp.cassandra
post_tasks:
- name: Wait for the Cassandra Listener
ansible.builtin.wait_for:
host: "{{ ansible_default_ipv4.address }}"
port: 9042
when: not ansible_check_mode
- name: Wait for the Cassandra Service to be Running (Red Hat)
ansible.builtin.service_facts:
retries: 100
delay: 3
register: cassandra_services_facts
until: cassandra_services_facts.ansible_facts.services['cassandra.service'].state == 'running'
when:
- not ansible_check_mode
- ansible_os_family == 'RedHat'
# service_facts broken for Fedora 32, fixed in Ansible 2.9.9
# see https://bugzilla.redhat.com/show_bug.cgi?id=1832625
# Still seeems to be broken for 33.
- ansible_distribution != "Fedora"
- name: Wait for the Cassandra Service to be Running (Debian)
ansible.builtin.service_facts:
retries: 100
delay: 3
register: cassandra_services_facts
until: cassandra_services_facts.ansible_facts.services['cassandra'].state == 'running'
when:
- not ansible_check_mode
- ansible_os_family == 'Debian'