--- - name: Check Git Deployment Logs hosts: production gather_facts: yes become: no tasks: - name: Get full container logs shell: | docker logs app --tail 100 args: executable: /bin/bash register: container_logs changed_when: false - name: Get Git-related logs shell: | docker logs app --tail 100 | grep -E "(Git|Clone|Pull|✅|❌|📥|📦|🔄|🗑️)" || echo "No Git-related logs found" args: executable: /bin/bash register: git_logs changed_when: false - name: Check GIT_REPOSITORY_URL environment variable shell: | docker exec app env | grep GIT_REPOSITORY_URL || echo "GIT_REPOSITORY_URL not set" args: executable: /bin/bash register: git_env changed_when: false ignore_errors: yes - name: Check if .git directory exists shell: | docker exec app test -d /var/www/html/.git && echo "✅ Git repo vorhanden" || echo "❌ Git repo fehlt" args: executable: /bin/bash register: git_repo_check changed_when: false ignore_errors: yes - name: Check entrypoint script for Git functionality shell: | docker exec app cat /usr/local/bin/entrypoint.sh | grep -A 5 "GIT_REPOSITORY_URL" | head -10 || echo "Entrypoint script not found or no Git functionality" args: executable: /bin/bash register: entrypoint_check changed_when: false ignore_errors: yes - name: Display Git-related logs debug: msg: - "=== Git-Related Logs ===" - "{{ git_logs.stdout }}" - "" - "=== Git Environment Variable ===" - "{{ git_env.stdout }}" - "" - "=== Git Repository Check ===" - "{{ git_repo_check.stdout }}" - "" - "=== Entrypoint Git Check ===" - "{{ entrypoint_check.stdout }}" - name: Display full logs (last 50 lines) debug: msg: "{{ container_logs.stdout_lines[-50:] | join('\n') }}"