From 9666b2def5511f86b23b26e988d140660eb853ec Mon Sep 17 00:00:00 2001 From: gene-redpanda <123959009+gene-redpanda@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:51:58 -0500 Subject: [PATCH 1/2] test-console-changes --- requirements.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.yml b/requirements.yml index ed39429..6319649 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,7 +1,8 @@ collections: - name: community.general - - name: redpanda.cluster - type: galaxy + - name: https://github.com/redpanda-data/redpanda-ansible-collection.git + type: git + version: console-config-changes - name: ansible.posix - name: grafana.grafana version: 5.6.0 From 82bada37b83514895dd7a8b24a2757982565d89f Mon Sep 17 00:00:00 2001 From: gene-redpanda <123959009+gene-redpanda@users.noreply.github.com> Date: Thu, 31 Jul 2025 12:34:32 -0500 Subject: [PATCH 2/2] feat: add operation for log config --- Makefile | 8 +++ ansible/operation-configure-logging.yml | 72 +++++++++++++++++++++++++ aws/main.tf | 4 +- 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 ansible/operation-configure-logging.yml diff --git a/Makefile b/Makefile index 1bb266b..259ccf9 100644 --- a/Makefile +++ b/Makefile @@ -300,6 +300,14 @@ cluster: ansible-prereqs @mkdir -p $(ARTIFACT_DIR)/logs @ansible-playbook ansible/provision-cluster.yml --private-key $(PRIVATE_KEY) --inventory $(ANSIBLE_INVENTORY) --extra-vars is_using_unstable=$(IS_USING_UNSTABLE) +# Logging configuration +REDPANDA_LOGGING_LOG_FILE ?= /var/log/redpanda2/redpanda.log + +.PHONY: operation-configure-logging +operation-configure-logging: ansible-prereqs + @mkdir -p $(ARTIFACT_DIR)/logs + @ansible-playbook ansible/operation-configure-logging.yml --private-key $(PRIVATE_KEY) --inventory $(ANSIBLE_INVENTORY) --extra-vars is_using_unstable=$(IS_USING_UNSTABLE) --extra-vars redpanda_logging_log_file=$(REDPANDA_LOGGING_LOG_FILE) + TEST_TOPIC_NAME ?= testtopic PARTITION_COUNT ?= 3 .PHONY: test-cluster diff --git a/ansible/operation-configure-logging.yml b/ansible/operation-configure-logging.yml new file mode 100644 index 0000000..9cea0d7 --- /dev/null +++ b/ansible/operation-configure-logging.yml @@ -0,0 +1,72 @@ +--- +- name: Configure Redpanda Logging + hosts: redpanda + become: true + vars: + rpk_bin: rpk + + tasks: + - name: Check cluster health + ansible.builtin.shell: | + {{ rpk_bin }} cluster health | grep -i 'healthy:' | tr -d '[:space:]' | awk -F ':' '{print tolower($2)}' + register: health_check + run_once: true + failed_when: "health_check.stdout != 'true'" + changed_when: false + + - name: Apply logging role + ansible.builtin.include_role: + name: /Users/gene/GolandProjects/redpanda-ansible-collection/roles/redpanda_logging + vars: + redpanda_logging_log_file: "{{ redpanda_logging_log_file | default('/var/log/redpanda.log') }}" + + - name: Verify logging directory exists + ansible.builtin.stat: + path: "{{ redpanda_logging_log_file | default('/var/log/redpanda.log') | dirname }}" + register: log_dir_check + failed_when: not log_dir_check.stat.exists or not log_dir_check.stat.isdir + + - name: Verify rsyslog configuration + ansible.builtin.stat: + path: "/etc/rsyslog.d/{{ redpanda_logging_rsyslog_priority | default('40') }}-redpanda.conf" + register: rsyslog_config_check + when: redpanda_logging_rsyslog_enabled | default(true) + failed_when: not rsyslog_config_check.stat.exists + + - name: Verify logrotate configuration + ansible.builtin.stat: + path: /etc/logrotate.d/redpanda + register: logrotate_config_check + when: redpanda_logging_logrotate_enabled | default(true) + failed_when: not logrotate_config_check.stat.exists + + - name: Test log rotation (dry run) + ansible.builtin.command: logrotate -d /etc/logrotate.d/redpanda + register: logrotate_test + when: redpanda_logging_logrotate_enabled | default(true) + changed_when: false + + - name: Verify log file exists with correct permissions + ansible.builtin.stat: + path: "{{ redpanda_logging_log_file | default('/var/log/redpanda.log') }}" + register: log_file_check + failed_when: > + not log_file_check.stat.exists or + log_file_check.stat.pw_name != (redpanda_logging_owner | default('syslog')) or + log_file_check.stat.gr_name != (redpanda_logging_group | default('adm')) + + - name: Check broker status + ansible.builtin.shell: | + {{ rpk_bin }} redpanda admin brokers list | grep -q 'active.*true' + register: broker_status + changed_when: false + failed_when: broker_status.rc != 0 + + - name: Display logging configuration summary + ansible.builtin.debug: + msg: + - "Redpanda logging configuration completed" + - "Log file: {{ redpanda_logging_log_file | default('/var/log/redpanda.log') }}" + - "Rsyslog: {{ 'enabled' if (redpanda_logging_rsyslog_enabled | default(true)) else 'disabled' }}" + - "Logrotate: {{ 'enabled' if (redpanda_logging_logrotate_enabled | default(true)) else 'disabled' }}" + run_once: true \ No newline at end of file diff --git a/aws/main.tf b/aws/main.tf index c584783..953f6cd 100644 --- a/aws/main.tf +++ b/aws/main.tf @@ -43,7 +43,7 @@ variable "prometheus_instance_type" { } variable "availability_zone" { - default = ["us-west-2a"] + default = ["us-east-2a"] type = list(string) } @@ -127,7 +127,7 @@ terraform { variable "aws_region" { type = string - default = "us-west-2" + default = "us-east-2" } provider "aws" {