node-deployment.yaml

Overview

The node-deployment.yaml file is an Ansible playbook designed to automate the deployment process of the "Block keeper" component within a specified group of hosts. The playbook focuses on managing the lifecycle of the block keeper service, including conditional control over data deletion and service start-up. This file is intended for use in orchestrating deployments in an environment where the block keeper nodes are grouped under a specific inventory group, defaulting to "block_keepers" if no target group is specified.

File Structure and Purpose

This playbook defines a single play with the following key attributes:

Detailed Explanation of Key Sections

Hosts Selection

hosts: '{{ target | default("block_keepers") }}'
ansible-playbook node-deployment.yaml -e "target=custom_block_keepers"

This command overrides the default hosts group.

Variables

vars:
  DELETE_DATA: no
  DO_START: yes

These variables are passed to the block-keeper role and influence its behavior. For example, if DELETE_DATA is set to "yes", the role might purge old data before redeploying.

Roles

roles:
  - block-keeper

Interaction with Other System Components

Visual Diagram

flowchart TD
A[Start node-deployment.yaml] --> B{Hosts specified?}
B -- Yes --> C[Target hosts = target variable]
B -- No --> D[Target hosts = "block_keepers"]
C --> E[Set vars DELETE_DATA, DO_START]
D --> E
E --> F[Invoke block-keeper role]
F --> G{block-keeper Role}
G --> H[Check DELETE_DATA flag]
G --> I[Check DO_START flag]
H --> J[Delete data if yes]
I --> K[Start service if yes]
J --> L[Deploy block keeper]
K --> L
L --> M[Deployment complete]

This flowchart represents the main workflow within this playbook:


For further understanding of Ansible playbook syntax and role-based deployment, refer to Ansible Playbooks and Role-Based Automation. The dynamic host targeting mechanism relates to Inventory Management.