Use container wrapper for docker logs across roles

https://chatgpt.com/share/698659d9-62e4-800f-89a1-5d44f309bde4
This commit is contained in:
kevinveenbirkenbach committed 2026-02-06 22:28:38 +01:00
1 parent 646bd80290
commit 2147690da0
5 files changed
+12 -10

No files matched your search

+5 -5
View File
@@ -21,8 +21,8 @@
rescue:
- name: "POSTGRES | docker logs (last 200 lines)"
ansible.builtin.command: "docker logs --tail 200 {{ POSTGRES_CONTAINER }}"
- name: "POSTGRES | {{ BIN_CONTAINER }} logs (last 200 lines)"
ansible.builtin.command: "{{ BIN_CONTAINER }} logs --tail 200 {{ POSTGRES_CONTAINER }}"
register: dbg_docker_logs
changed_when: false
failed_when: false
@@ -147,8 +147,8 @@
changed_when: false
failed_when: false
- name: "POSTGRES | docker logs (last 250 lines)"
ansible.builtin.command: "docker logs --tail 250 {{ POSTGRES_CONTAINER }}"
- name: "POSTGRES | {{ BIN_CONTAINER }} logs (last 250 lines)"
ansible.builtin.command: "{{ BIN_CONTAINER }} logs --tail 250 {{ POSTGRES_CONTAINER }}"
register: dbg_docker_logs
changed_when: false
failed_when: false
@@ -240,7 +240,7 @@
ansible.builtin.fail:
msg: >-
Failed to ALTER ROLE "{{ database_username }}" WITH LOGIN.
See debug output above (docker logs, inspect, pg_isready, psql auth test, hba/config).
See debug output above ({{ BIN_CONTAINER }} logs, inspect, pg_isready, psql auth test, hba/config).
# 4) Grant ALL privileges on all tables in the public schema
- name: "Grant ALL privileges on tables in public schema to {{ database_username }}"
@@ -30,7 +30,8 @@
failed_when: false
ignore_errors: true
- ansible.builtin.command: docker logs --tail=200 {{ OPENRESTY_CONTAINER }}
- ansible.builtin.command: >
{{ BIN_CONTAINER }} logs --tail=200 {{ OPENRESTY_CONTAINER }}
register: openresty_logs
changed_when: false
failed_when: false
+1 -1
View File
@@ -27,7 +27,7 @@
- name: Dump OpenResty container logs on failure
command: >
docker logs --tail=200 {{ OPENRESTY_CONTAINER }}
{{ BIN_CONTAINER }} logs --tail=200 {{ OPENRESTY_CONTAINER }}
register: openresty_logs
changed_when: false
failed_when: false
+3 -2
View File
@@ -45,7 +45,8 @@
failed_when: false
- name: Show Moodle container logs
ansible.builtin.shell: docker logs --tail=200 {{ MOODLE_CONTAINER }}
ansible.builtin.shell: >
{{ BIN_CONTAINER }} logs --tail=200 {{ MOODLE_CONTAINER }}
register: moodle_logs
changed_when: false
failed_when: false
@@ -58,7 +59,7 @@
--- {{ BIN_CONTAINER }} inspect ---
{{ moodle_inspect.stdout | default('no output') }}
--- docker logs (last 200 lines) ---
--- {{ BIN_CONTAINER }} logs (last 200 lines) ---
{{ moodle_logs.stdout | default('no output') }}
- name: "Include ownership settings tasks for moodle"
+1 -1
View File
@@ -106,7 +106,7 @@
- name: "XWIKI | DEBUG | Tail container logs"
ansible.builtin.shell: |
set -euo pipefail
docker logs --tail 300 "{{ XWIKI_CONTAINER }}" || true
{{ BIN_CONTAINER }} logs --tail 300 "{{ XWIKI_CONTAINER }}" || true
register: _dbg_logs
changed_when: false
failed_when: false