From 8418ba8dd88b4f48418d6f91827de7682474cbfb Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 18 Jan 2024 12:53:50 +0100 Subject: [PATCH] Fix the data directory permissions. Add the default template. --- tasks/cassandra-configuration.yml | 23 ++++++++++++++++++++++- templates/cassandra-default.j2 | 7 +++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 templates/cassandra-default.j2 diff --git a/tasks/cassandra-configuration.yml b/tasks/cassandra-configuration.yml index a5a6c46..f1aedd3 100644 --- a/tasks/cassandra-configuration.yml +++ b/tasks/cassandra-configuration.yml @@ -2,6 +2,28 @@ - name: cassandra-configuration | Manage the Cassandra configuration tags: [cassandra, cassandra_conf, cassandra_service] block: + - name: cassandra-configuration | Ensure that the data folders exist and have the proper permissions + ansible.builtin.file: + dest: "{{ item }}" + state: directory + owner: cassandra + group: cassandra + mode: "0750" + loop: + - "{{ cassandra_data_dir }}" + - "{{ cassandra_data_dir }}/.cache" + - "{{ cassandra_data_dir }}/commitlog" + - "{{ cassandra_data_dir }}/data" + - "{{ cassandra_data_dir }}/hints" + - "{{ cassandra_data_dir }}/saved_caches" + - name: cassandra-configuration | Install the default env file + ansible.builtin.template: + src: cassandra-default.j2 + dest: "/etc/default/cassandra" + owner: root + group: cassandra + mode: "0640" + notify: Restart Cassandra - name: cassandra-configuration | Install the main configuration file ansible.builtin.template: src: cassandra.yaml.j2 @@ -10,7 +32,6 @@ group: cassandra mode: "0640" notify: Restart Cassandra - - name: cassandra-configuration | Install the rackdc configuration file ansible.builtin.template: src: cassandra-rackdc.properties.j2 diff --git a/templates/cassandra-default.j2 b/templates/cassandra-default.j2 new file mode 100644 index 0000000..1b56a98 --- /dev/null +++ b/templates/cassandra-default.j2 @@ -0,0 +1,7 @@ +# NOTICE: See also /etc/cassandra/cassandra-env.sh + +# EXTRA_CLASSPATH provides the means to extend Cassandra's classpath with +# additional libraries. It is formatted as a colon-delimited list of +# class directories and/or jar files. For example, to enable the +# JMX-to-web bridge install libmx4j-java and uncomment the following. +#EXTRA_CLASSPATH="/usr/share/java/mx4j-tools.jar"