From cdec5ce87cfd932ac4476751cfeda66038a65b46 Mon Sep 17 00:00:00 2001 From: dvirlabs <114520947+dvirlabs@users.noreply.github.com> Date: Thu, 23 Apr 2026 11:40:17 +0300 Subject: [PATCH] Debug api request --- ansible/playbooks/drift-check.yml | 16 ++++++++-------- update-gitops-status.sh | 9 ++++++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ansible/playbooks/drift-check.yml b/ansible/playbooks/drift-check.yml index dd290c9..138ccea 100644 --- a/ansible/playbooks/drift-check.yml +++ b/ansible/playbooks/drift-check.yml @@ -13,14 +13,14 @@ # against live server files without actually writing anything. # changed=true → file differs → drift # changed=false → files match → synced + # + # NOTE: Only checking file CONTENT, not permissions/ownership + # The validate.yml playbook enforces permissions on deploy # ------------------------------------------------------------------------- - name: Check main rsyslog.conf ansible.builtin.copy: src: "{{ playbook_dir }}/../../files/rsyslog.conf" dest: "{{ rsyslog_main_config }}" - owner: root - group: root - mode: '0644' check_mode: true diff: true register: main_config_check @@ -29,9 +29,6 @@ ansible.builtin.copy: src: "{{ playbook_dir }}/../../files/rsyslog.d/" dest: "{{ rsyslog_config_dir }}/" - owner: root - group: root - mode: '0644' check_mode: true diff: true register: rsyslogd_check @@ -85,12 +82,10 @@ - name: Show main config change status ansible.builtin.debug: msg: "Main config (rsyslog.conf) changed: {{ main_config_check.changed }}" - when: drift_detected - name: Show rsyslog.d change status ansible.builtin.debug: msg: "rsyslog.d directory changed: {{ rsyslogd_check.changed }}" - when: drift_detected - name: Show main config diff if changed ansible.builtin.debug: @@ -102,6 +97,11 @@ var: rsyslogd_check.diff when: rsyslogd_check.changed and rsyslogd_check.diff is defined + - name: Show rsyslog.d diff list + ansible.builtin.debug: + msg: "rsyslogd_check details: {{ rsyslogd_check }}" + when: rsyslogd_check.changed + # ───────────────────────────────────────────────────────────────────────── # Build structured list of changed files for GitOps status server # This data is parsed by the update-gitops-status.sh wrapper script diff --git a/update-gitops-status.sh b/update-gitops-status.sh index 2c4b30c..ec5a71c 100644 --- a/update-gitops-status.sh +++ b/update-gitops-status.sh @@ -223,6 +223,10 @@ echo " URL: $GITOPS_STATUS_SERVER_URL/api/status" echo " Method: POST" echo " Payload size: $(echo "$STATUS_JSON" | wc -c) bytes" echo "" +echo " ========== JSON PAYLOAD BEING SENT ==========" +echo "$STATUS_JSON" | jq '.' 2>/dev/null || echo "$STATUS_JSON" +echo " ==========================================" +echo "" # Test connectivity first echo " Testing connectivity to gitops-status-server..." @@ -240,7 +244,10 @@ echo "" RESPONSE_BODY=$(mktemp) trap "rm -f $RESPONSE_BODY $PLAYBOOK_LOG" EXIT -echo " Sending POST request..." +echo " Sending POST request with curl..." +echo " Command: curl -X POST -H 'Content-Type: application/json' -d '' $GITOPS_STATUS_SERVER_URL/api/status" +echo "" + # POST the JSON to the gitops-status-server API with full error reporting # Capture both response code and body for debugging set +e