stop-bk.yaml

Overview

The stop-bk.yaml file is an Ansible playbook that orchestrates the shutdown process of a service or application stack managed via Docker Compose. It provides a structured approach to stopping containers gracefully, with fallback to a forced termination if necessary. This file is primarily used to manage the lifecycle of Docker containers within the directory specified by the BK_DIR variable.

Detailed Breakdown

This playbook consists of three sequential tasks:

1. Graceful shutdown request before stop

2. Compose stop

3. Compose stop (hard)

Implementation Details

Interaction with Other Parts of the System

Mermaid Diagram - Workflow of stop-bk.yaml

flowchart TD
A[Start stop-bk.yaml] --> B[Include graceful-shutdown.yaml]
B --> C[Run "docker compose stop" in BK_DIR]
C --> D[Run "docker compose kill" in BK_DIR]
D --> E[End]

This diagram illustrates the linear flow of tasks executed in this playbook, emphasizing the sequential execution from graceful shutdown request to forced container termination.