First commit.
This commit is contained in:
parent
5fadd1bb0a
commit
7b80fc78a4
38
README.md
38
README.md
|
@ -1,31 +1,33 @@
|
|||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
A role that installs and configures Cassandra, <https://cassandra.apache.org/>
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
The most important variables are listed below:
|
||||
|
||||
``` yaml
|
||||
cassandra_install_from_external_repo: true
|
||||
cassandra_install_packages: true
|
||||
cassandra_latest_version: true
|
||||
cassandra_start_server: true
|
||||
cassandra_cluster_enabled: false
|
||||
cassandra_cluster_port: 7000
|
||||
cassandra_cluster_ssl_port: 7001
|
||||
cassandra_native_transport_port: 9042
|
||||
cassandra_rpc_port: 9160
|
||||
cassandra_jmx_port: 7199
|
||||
cassandra_allowed_hosts:
|
||||
- 127.0.0.1/8
|
||||
- '{{ ansible_default_ipv4.address }}/32'
|
||||
```
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
None
|
||||
|
||||
License
|
||||
-------
|
||||
|
@ -35,4 +37,4 @@ EUPL-1.2
|
|||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
Andrea Dell'Amico, <andrea.dellamico@isti.cnr.it>
|
||||
|
|
|
@ -1,2 +1,43 @@
|
|||
---
|
||||
# defaults file for ansible-role-template
|
||||
cassandra_install_from_external_repo: true
|
||||
cassandra_repo_key_url: "https://downloads.apache.org/cassandra/KEYS"
|
||||
cassandra_repository_rel: "41x"
|
||||
cassandra_deb_repo_key: /etc/apt/keyrings/cassandra.asc
|
||||
cassandra_deb_repository_url: "https://debian.cassandra.apache.org/"
|
||||
cassandra_deb_packages:
|
||||
- cassandra
|
||||
- cassandra-tools
|
||||
cassandra_el_repo_url: https://redhat.cassandra.apache.org/
|
||||
cassandra_latest_version: true
|
||||
cassandra_start_server: true
|
||||
cassandra_cluster_enabled: false
|
||||
cassandra_cluster_dc_name: "dc"
|
||||
cassandra_cluster_rack: 1
|
||||
cassandra_cluster_port: 7000
|
||||
cassandra_cluster_ssl_port: 7001
|
||||
cassandra_native_transport_port: 9042
|
||||
cassandra_rpc_port: 9160
|
||||
cassandra_jmx_port: 7199
|
||||
cassandra_conf_dir: /etc/cassandra
|
||||
cassandra_log_dir: /var/log/cassandra
|
||||
cassandra_data_dir: /var/lib/cassandra
|
||||
cassandra_startup_options_file: /etc/default/cassandra
|
||||
# Configuration options
|
||||
cassandra_allowed_hosts:
|
||||
- 127.0.0.1/8
|
||||
- '{{ ansible_default_ipv4.address }}/32'
|
||||
cassandra_cluster_name: "Cassandra Cluster"
|
||||
cassandra_num_tokens: 16
|
||||
cassandra_tokens_for_local_replica: 3
|
||||
cassandra_data_file_directories:
|
||||
- "{{ cassandra_data_dir }}/data"
|
||||
cassandra_commitlog_directory: "{{ cassandra_data_dir }}/commitlog"
|
||||
cassandra_saved_caches_directory: "{{ cassandra_data_dir }}/saved_caches"
|
||||
# List the IP addresses here
|
||||
cassandra_seed_addresses: ""
|
||||
cassandra_listen_address: "{{ ansible_default_ipv4.address }}"
|
||||
cassandra_broadcast_address: "{{ ansible_default_ipv4.address }}"
|
||||
cassandra_rpc_address: "{{ ansible_default_ipv4.address }}"
|
||||
cassandra_broadcast_rpc_address: "{{ ansible_default_ipv4.address }}"
|
||||
cassandra_rpc_keepalive: "true"
|
||||
cassandra_startup_checks_enabled: "false"
|
|
@ -1,2 +1,6 @@
|
|||
---
|
||||
# handlers file for ansible-role-template
|
||||
- name: Restart Cassandra
|
||||
ansible.builtin.service:
|
||||
name: cassandra
|
||||
state: restarted
|
||||
when: cassandra_start_server
|
||||
|
|
|
@ -1,46 +1,31 @@
|
|||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
author: Andrea Dell'Amico
|
||||
description: Role that installs Cassandra, <https://cassandra.apache.org/>
|
||||
company: ISTI-CNR
|
||||
namespace: adellam
|
||||
role_name: cassandra
|
||||
license: EUPL 1.2+
|
||||
min_ansible_version: "2.9"
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
issue_tracker_url: https://support.d4science.org/projects/automatic-provisioning/issues
|
||||
|
||||
license: EUPL-1.2
|
||||
|
||||
min_ansible_version: 2.8
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- bionic
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- focal
|
||||
- jammy
|
||||
- name: EL
|
||||
versions:
|
||||
- "8"
|
||||
- "9"
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
galaxy_tags:
|
||||
- cassandra
|
||||
- nosql
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
dependencies:
|
||||
- src: git+https://gitea-s2i2s.isti.cnr.it/ISTI-ansible-roles/ansible-role-openjdk.git
|
||||
version: master
|
||||
name: openjdk
|
||||
state: latest
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- name: cassandra-configuration | Manage the Cassandra configuration
|
||||
tags: [cassandra, cassandra_conf, cassandra_service]
|
||||
block:
|
||||
- name: cassandra-configuration | Install the main configuration file
|
||||
ansible.builtin.template:
|
||||
src: cassandra.yaml.j2
|
||||
dest: "{{ cassandra_conf_dir }}/cassandra.yaml"
|
||||
owner: root
|
||||
group: cassandra
|
||||
mode: "0640"
|
||||
notify: Restart Cassandra
|
||||
|
||||
- name: cassandra-configuration | Install the rackdc configuration file
|
||||
ansible.builtin.template:
|
||||
src: cassandra-rackdc.properties.j2
|
||||
dest: "{{ cassandra_conf_dir }}/cassandra-rackdc.properties"
|
||||
owner: root
|
||||
group: cassandra
|
||||
mode: "0640"
|
||||
notify: Restart Cassandra
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: cassandra-packages | Manage the cassandra packages
|
||||
tags: [cassandra]
|
||||
when: ansible_distribution_file_variety == "Debian"
|
||||
block:
|
||||
- name: cassandra-packages | Install the cassandra server
|
||||
ansible.builtin.apt:
|
||||
pkg: "{{ cassandra_deb_packages }}"
|
||||
state: present
|
||||
cache_valid_time: 1800
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
- name: cassandra-repo | Manage the Cassandra repository on deb systems
|
||||
when:
|
||||
- cassandra_install_from_external_repo
|
||||
- ansible_distribution_file_variety == "Debian"
|
||||
tags: ['cassandra', 'cassandra_repo', 'cassandra_pkgs']
|
||||
block:
|
||||
- name: cassandra-repo | Ensure that /etc/apt.d/keyrings exists
|
||||
ansible.builtin.file:
|
||||
dest: /etc/apt/keyrings
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
- name: cassandra-repo | Get the signing key for the cassandra.apache.org repository
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ cassandra_deb_repo_key_url }}"
|
||||
dest: "{{ cassandra_repo_key }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
- name: cassandra-repo | Install the repository for Ubuntu
|
||||
ansible.builtin.deb822_repository:
|
||||
name: cassandra
|
||||
types: [deb]
|
||||
uris: "{{ cassandra_deb_repository_url }}"
|
||||
components:
|
||||
- main
|
||||
suites: ["{{ cassandra_repository_rel }}"]
|
||||
signed_by: "{{ cassandra_repo_key }}"
|
||||
state: present
|
||||
enabled: true
|
||||
|
||||
- name: cassandra-repo | Manage the Cassandra repository on EL systems
|
||||
when:
|
||||
- cassandra_install_from_external_repo
|
||||
- ansible_distribution_file_variety == "RedHat"
|
||||
tags: ['cassandra', 'cassandra_repo', 'cassandra_pkgs']
|
||||
block:
|
||||
- name: cassandra-repo | RPM repository for Cassandra packages
|
||||
ansible.builtin.template:
|
||||
src: cassandra.repo.j2
|
||||
dest: /etc/yum.repos.d/cassandra.repo
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
|
@ -1,2 +1,23 @@
|
|||
---
|
||||
# tasks file for ansible-role-template
|
||||
- name: Cassandra repositories
|
||||
ansible.builtin.import_tasks: cassandra-repo.yml
|
||||
- name: Cassandra packages
|
||||
ansible.builtin.import_tasks: cassandra-packages.yml
|
||||
- name: Cassandra configuration
|
||||
ansible.builtin.import_tasks: cassandra-configuration.yml
|
||||
|
||||
- name: Ensure cassandra is started and enabled
|
||||
ansible.builtin.service:
|
||||
name: cassandra
|
||||
state: started
|
||||
enabled: true
|
||||
when: cassandra_start_server
|
||||
tags: [cassandra, cassandra_service]
|
||||
|
||||
- name: Ensure cassandra is stopped and disabled
|
||||
ansible.builtin.service:
|
||||
name: cassandra
|
||||
state: stopped
|
||||
enabled: false
|
||||
when: not cassandra_start_server
|
||||
tags: [cassandra, cassandra_service]
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# These properties are used with GossipingPropertyFileSnitch and will
|
||||
# indicate the rack and dc for this node
|
||||
dc={{ cassandra_cluster_dc_name }}
|
||||
rack={{ cassandra_cluster_rack }}
|
||||
|
||||
# Add a suffix to a datacenter name. Used by the Ec2Snitch and Ec2MultiRegionSnitch
|
||||
# to append a string to the EC2 region name.
|
||||
#dc_suffix=
|
||||
|
||||
# Uncomment the following line to make this snitch prefer the internal ip when possible, as the Ec2MultiRegionSnitch does.
|
||||
# prefer_local=true
|
||||
|
||||
# Datacenter and rack naming convention used by the Ec2Snitch and Ec2MultiRegionSnitch.
|
||||
# Options are:
|
||||
# legacy : datacenter name is the part of the availability zone name preceding the last "-"
|
||||
# when the zone ends in -1 and includes the number if not -1. Rack is the portion of
|
||||
# the availability zone name following the last "-".
|
||||
# Examples: us-west-1a => dc: us-west, rack: 1a; us-west-2b => dc: us-west-2, rack: 2b;
|
||||
# YOU MUST USE THIS VALUE IF YOU ARE UPGRADING A PRE-4.0 CLUSTER
|
||||
# standard : Default value. datacenter name is the standard AWS region name, including the number.
|
||||
# rack name is the region plus the availability zone letter.
|
||||
# Examples: us-west-1a => dc: us-west-1, rack: us-west-1a; us-west-2b => dc: us-west-2, rack: us-west-2b;
|
||||
# ec2_naming_scheme=standard
|
||||
#
|
||||
# Type of AWS IMDS, value might be either "v1" or "v2". Defaults to "v2".
|
||||
# ec2_metadata_type=v2
|
||||
# If AWS IMDS of v2 is configured, ec2_metadata_token_ttl_seconds says how many seconds a token will be valid until
|
||||
# it is refreshed. Defaults to 21600. Can not be smaller than 30 and bigger than 21600. Has to be an integer.
|
||||
# ec2_metadata_token_ttl_seconds=21600
|
|
@ -0,0 +1,6 @@
|
|||
[cassandra]
|
||||
name=Apache Cassandra
|
||||
baseurl={{ cassandra_el_repo_url }}{{ cassandra_repository_rel }}/
|
||||
gpgcheck=1
|
||||
repo_gpgcheck=1
|
||||
gpgkey={{ cassandra_repo_key_url }}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue