From 6c610c8d19964b80403c04b2610240f80237834a Mon Sep 17 00:00:00 2001 From: Simon Leigh Date: Sun, 13 Aug 2023 13:44:02 +1200 Subject: [PATCH] Add support for providing additional configuration params to be templated into the server.properties file --- README.md | 87 +++++++++++++++++----------------- templates/server.properties.j2 | 4 ++ 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index d81cbaf..9198d0c 100644 --- a/README.md +++ b/README.md @@ -41,49 +41,50 @@ See for more information. ## Role Variables -| Variable | Default | -| ---------------------------------------------- | ------------------------------------ | -| kafka_download_base_url | | -| kafka_download_validate_certs | yes | -| kafka_version | 3.2.3 | -| kafka_scala_version | 2.13 | -| kafka_create_user_group | true | -| kafka_user | kafka | -| kafka_group | kafka | -| kafka_root_dir | /opt | -| kafka_dir | {{ kafka_root_dir }}/kafka | -| kafka_start | yes | -| kafka_restart | yes | -| kafka_log_dir | /var/log/kafka | -| kafka_broker_id | 0 | -| kafka_java_heap | -Xms1G -Xmx1G | -| kafka_background_threads | 10 | -| kafka_listeners | PLAINTEXT://:9092 | -| kafka_num_network_threads | 3 | -| kafka_num_io_threads | 8 | -| kafka_num_replica_fetchers | 1 | -| kafka_socket_send_buffer_bytes | 102400 | -| kafka_socket_receive_buffer_bytes | 102400 | -| kafka_socket_request_max_bytes | 104857600 | -| kafka_replica_socket_receive_buffer_bytes | 65536 | -| kafka_data_log_dirs | /var/lib/kafka/logs | -| kafka_num_partitions | 1 | -| kafka_num_recovery_threads_per_data_dir | 1 | -| kafka_log_cleaner_threads | 1 | -| kafka_offsets_topic_replication_factor | 1 | -| kafka_transaction_state_log_replication_factor | 1 | -| kafka_transaction_state_log_min_isr | 1 | -| kafka_log_retention_hours | 168 | -| kafka_log_segment_bytes | 1073741824 | -| kafka_log_retention_check_interval_ms | 300000 | -| kafka_auto_create_topics_enable | false | -| kafka_delete_topic_enable | true | -| kafka_default_replication_factor | 1 | -| kafka_group_initial_rebalance_delay_ms | 0 | -| kafka_zookeeper_connect | localhost:2181 | -| kafka_zookeeper_connection_timeout | 6000 | -| kafka_bootstrap_servers | localhost:9092 | -| kafka_consumer_group_id | kafka-consumer-group | +| Variable | Default | Comments | +| ---------------------------------------------- | ------------------------------------ | ---------------------------------------------------------------- | +| kafka_download_base_url | | | +| kafka_download_validate_certs | yes | | +| kafka_version | 3.2.3 | | +| kafka_scala_version | 2.13 | | +| kafka_create_user_group | true | | +| kafka_user | kafka | | +| kafka_group | kafka | | +| kafka_root_dir | /opt | | +| kafka_dir | {{ kafka_root_dir }}/kafka | | +| kafka_start | yes | | +| kafka_restart | yes | | +| kafka_log_dir | /var/log/kafka | | +| kafka_broker_id | 0 | | +| kafka_java_heap | -Xms1G -Xmx1G | | +| kafka_background_threads | 10 | | +| kafka_listeners | PLAINTEXT://:9092 | | +| kafka_num_network_threads | 3 | | +| kafka_num_io_threads | 8 | | +| kafka_num_replica_fetchers | 1 | | +| kafka_socket_send_buffer_bytes | 102400 | | +| kafka_socket_receive_buffer_bytes | 102400 | | +| kafka_socket_request_max_bytes | 104857600 | | +| kafka_replica_socket_receive_buffer_bytes | 65536 | | +| kafka_data_log_dirs | /var/lib/kafka/logs | | +| kafka_num_partitions | 1 | | +| kafka_num_recovery_threads_per_data_dir | 1 | | +| kafka_log_cleaner_threads | 1 | | +| kafka_offsets_topic_replication_factor | 1 | | +| kafka_transaction_state_log_replication_factor | 1 | | +| kafka_transaction_state_log_min_isr | 1 | | +| kafka_log_retention_hours | 168 | | +| kafka_log_segment_bytes | 1073741824 | | +| kafka_log_retention_check_interval_ms | 300000 | | +| kafka_auto_create_topics_enable | false | | +| kafka_delete_topic_enable | true | | +| kafka_default_replication_factor | 1 | | +| kafka_group_initial_rebalance_delay_ms | 0 | | +| kafka_zookeeper_connect | localhost:2181 | | +| kafka_zookeeper_connection_timeout | 6000 | | +| kafka_bootstrap_servers | localhost:9092 | | +| kafka_consumer_group_id | kafka-consumer-group | | +| kafka_server_config_params | | General dictionary that will be templated into server.properties | See [log4j.yml](./defaults/main/002-log4j.yml) for detailed log4j-related available variables. diff --git a/templates/server.properties.j2 b/templates/server.properties.j2 index 2055024..a082c5a 100644 --- a/templates/server.properties.j2 +++ b/templates/server.properties.j2 @@ -193,3 +193,7 @@ ssl.keystore.password={{ kafka_ssl.keystore_password }} ssl.key.password={{ kafka_ssl.key_password }} ssl.client.auth={{ kafka_ssl.client_auth }} {% endif %} + +{% for key, value in (kafka_server_config_params | default({})).items() %} +{{key}}={{value}} +{% endfor %} \ No newline at end of file