stop-delete-logs.yaml

Overview

This YAML file defines an Ansible playbook sequence to manage the shutdown and cleanup of logging resources related to a containerized application. Its primary functions are to:

It is designed to be used in scenarios where log cleanup is necessary, such as preparing for a fresh start or system maintenance, while optionally preserving data based on the DELETE_DATA flag.


Playbook Tasks and Functionality

1. Graceful shutdown request before compose down

2. Compose stop

3. Remove node logs dir

4. Recreate node logs dir


Important Implementation Details


Interactions with Other Components


Visual Diagram: Workflow of stop-delete-logs.yaml

flowchart TD
A[Start Playbook] --> B{DELETE_DATA?}
B -- No --> C[Include graceful-shutdown.yaml]
C --> D[Run 'docker compose stop' in BK_DIR]
B -- Yes --> E[Skip shutdown and stop steps]
D --> F[Remove BK_LOGS_DIR]
E --> F
F --> G[Create BK_LOGS_DIR with mode 777]
G --> H[End Playbook]

For further understanding of the graceful shutdown logic, refer to Graceful Shutdown Procedures. For detailed information on Docker Compose commands and lifecycle management, see Docker Compose Management. For environment variable usage and configuration, consult Configuration and Environment Variables.