{"id":15056857,"url":"https://github.com/wireapp/ansible-cassandra","last_synced_at":"2025-04-10T04:35:42.724Z","repository":{"id":43110893,"uuid":"157578203","full_name":"wireapp/ansible-cassandra","owner":"wireapp","description":"Ansible role to install an Apache Cassandra cluster","archived":false,"fork":false,"pushed_at":"2024-10-23T09:37:10.000Z","size":92,"stargazers_count":12,"open_issues_count":2,"forks_count":20,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-24T05:52:01.643Z","etag":null,"topics":["ansible","ansible-role","apache-cassandra","cassandra","cassandra-cluster","cassandra-repairs"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wireapp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-14T16:30:53.000Z","updated_at":"2024-11-19T15:13:26.000Z","dependencies_parsed_at":"2024-01-22T17:38:47.128Z","dependency_job_id":"445437e3-e0cc-41b3-b5b3-c538c4881540","html_url":"https://github.com/wireapp/ansible-cassandra","commit_stats":{"total_commits":32,"total_committers":11,"mean_commits":2.909090909090909,"dds":0.5,"last_synced_commit":"f5c2467f5df08361769603e4571bbf65b1267e53"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wireapp%2Fansible-cassandra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wireapp%2Fansible-cassandra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wireapp%2Fansible-cassandra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wireapp%2Fansible-cassandra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wireapp","download_url":"https://codeload.github.com/wireapp/ansible-cassandra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248158559,"owners_count":21057176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","apache-cassandra","cassandra","cassandra-cluster","cassandra-repairs"],"created_at":"2024-09-24T21:57:11.435Z","updated_at":"2025-04-10T04:35:42.690Z","avatar_url":"https://github.com/wireapp.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ansible-cassandra\n\nAnsible role to install an Apache Cassandra cluster supervised by systemd. Includes the following:\n\n* Some OS tuning options such as installing jemalloc, setting max_map_count and tcp_keepalive, disabling swap.\n* Bootstraps nodes using the IPs of the servers in the `cassandra_seed` (configurable) inventory group.\n* Weekly scheduled repairs via cron jobs that are non-overlapping (see `cassandra_repair_slots`).\n    * Note that **all** keyspaces will be scheduled for repairs\n* Incremental and full backup scripts as well as a restore script. (disabled by default, optional) (NOTE: needs better testing)\n    * backup/restore requires access to S3.\n* prometheus-style metrics using jmx-exporter\n\n**Status: beta**, see [TODOs](#todo)\n\n[![Build Status](https://travis-ci.org/wireapp/ansible-cassandra.svg?branch=master)](https://travis-ci.org/wireapp/ansible-cassandra)\n\n\u003c!-- vim-markdown-toc GFM --\u003e\n\n* [Ansible Requirements](#ansible-requirements)\n* [Role Variables](#role-variables)\n* [Dependencies](#dependencies)\n* [Platforms](#platforms)\n* [Example Playbook](#example-playbook)\n* [License](#license)\n* [A note on openjdk vs oracle:](#a-note-on-openjdk-vs-oracle)\n* [Development setup](#development-setup)\n* [Credits](#credits)\n* [TODO](#todo)\n\n\u003c!-- vim-markdown-toc --\u003e\n\n## Ansible Requirements\n\n- ansible \u003e= 2.4 (\u003e= 2.7.9 recommended)\n\n## Role Variables\n\nGive your cluster a better name:\n\n```yaml\n# set cassandra_cluster_name before running the playbook for the first time; never change it afterwards\ncassandra_cluster_name: default\n```\n\nYou may wish to override the following defaults to enable backups:\n\n```yaml\n# backups\ncassandra_backup_enabled: false # recommended to enable this\ncassandra_incremental_backup_enabled: false # enable for built-in incremental backup routine\ncassandra_backup_s3_bucket: # set a name here and ensure hosts have access rights to an S3 bucket\ncassandra_env: dev # used in naming backups in case you have more than one environment (e.g. production, staging, ...)\n```\n\nFor a list of all variables, see `defaults/main.yml`.\n\n## Dependencies\n\nThe following should be installed before installing this role:\n\n- Java 8 (openJDK or Oracle, see [A note on openjdk vs oracle:](#a-note-on-openjdk-vs-oracle))\n- ntp\n\nFor the above dependencies, you can use the same roles as in `molecule/default/requirements.yml` - but you don't have to.\n\n## Platforms\n\n- Currently tested with Ubuntu 16.04 and Ubuntu 18.04 (see [A note on Java 8 and Ubuntu 18.04](#a-note-on-Java-8-and-Ubuntu-18.04)).\n\n## Example Playbook\n\nAssuming an inventory with 5 nodes where you wish to install cassandra on, two of them seed nodes:\n\n```ini\n# hosts.ini\n[all]\nhost01 ansible_host=\u003csome IP\u003e\nhost02 ansible_host=\u003csome IP\u003e\nhost03 ansible_host=\u003csome IP\u003e\nhost04 ansible_host=\u003csome IP\u003e\nhost05 ansible_host=\u003csome IP\u003e\n\n[cassandra]\nhost01\nhost02\nhost03\nhost04\nhost05\n\n# cassandra_seed group will be used to configure seed bootstrapping\n# recommended is 2 seed nodes per datacenter\n[cassandra_seed]\nhost01\nhost02\n```\n\nThen the following should work and start your cluster:\n\n```yaml\n# playbook.yml\n\n- hosts: cassandra\n  vars:\n    # set cluster_name before running the playbook for the first time; never change it afterwards\n    cassandra_cluster_name: my_cluster\n    # set installed java package version manually. required when using Ubuntu 18.04. see: [A note on Java 8 and Ubuntu 18.04](#a-note-on-Java-8-and-Ubuntu-18.04)\n    java_packages: openjdk-8-jdk\n  roles:\n    # ensure to install java and ntp first, e.g. by running these roles (see Dependencies section):\n    # - ansible-ntp\n    # - ansible-role-java\n    - ansible-cassandra\n```\n\nIf you don't wish to configure cassandra seed nodes via a `cassandra_seed_groupname` (default: `cassandra_seed`) inventory group, you can configure them statically:\n\n```yaml\n  vars:\n    cassandra_seed_resolution: static\n    cassandra_seeds:\n      - 1.2.3.4\n      - ...\n```\n\n## License\n\nAGPL. See [LICENSE](LICENSE)\n\n## A note on openjdk vs oracle:\n\nAs of November 2018, the cassandra homepage lists both openJDK and Oracle Java as supported (and offers their download links).\n\nIn the [official upgrade-to-DSE docs](https://docs.datastax.com/en/pdf/upgrade.pdf) one can find:\n\n\u003e Important:\n\u003e Although Oracle JRE/JDK 8 is supported, DataStax does more\n\u003e extensive testing on OpenJDK 8 starting with DSE 6.0.3. This change is due to the\n\u003e end of public updates for Oracle JRE/JDK 8.)\n\nIt seems OpenJDK is the more future-proof JVM to use. This role is tested using openjdk.\n\n## A note on Java 8 and Ubuntu 18.04:\n\nIn order to deploy Java on Ubuntu using Ansible, we have been using the 'ansible-role-java' role. This role will install OpenJDK 11 on Ubuntu 18.04 by default. If you are using this role, it is required to set the 'java_packages' variable before running it. for example:\n```yaml\n# set the java packages installed by the ansible-role-java role manually.\njava_packages: openjdk-8-jdk\n```\n\n## Development setup\n\nInstall [molecule](https://github.com/ansible/molecule). E.g. ensure you have docker installed, then, using a virtualenv, `pip install molecule ansible docker`.\n\n* `molecule converge` to run the playbook against docker containers. If something fails, `molecule --debug converge` shows error details.\n* `molecule lint` and `molecule syntax` can be used to get feedback on your yaml changes.\n* `molecule test` to destroy + converge + converge again for idempotence + destroy\n\nIf you want 'mocule converge' to be run each time you save a file in this repository, install entr, then run 'make'.\n\n* troubleshooting: [this issue](https://github.com/ansible/ansible/issues/43884) has been observed with molecule, ansible 2.7 and docker. Workaround was to downgrade to ansible 2.5.\n\n## Credits\n\nThis role has been inspired by\n\n* internal role used at Wire initially targeting older OSes and older cassandra versions.\n* [this cassandra role](https://github.com/andrewrothstein/ansible-cassandra-cluster) and its dependent roles (insufficient for our needs)\n\n## TODO\n\n* [ ] WARN: JMX is not enabled to receive remote connections. Please see cassandra-env.sh for more info.\n* [ ] test backups and restore\n* [ ] document usage of prometheus .prom files and node-exporter\n* [ ] check out if instead of cron jobs a repair alternative could be https://github.com/thelastpickle/cassandra-reaper\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwireapp%2Fansible-cassandra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwireapp%2Fansible-cassandra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwireapp%2Fansible-cassandra/lists"}