# luisaostuff/san-basada-en-arm-y-alta-disponibilidad architecture

> Architecture diagram of the GitHub repository luisaostuff/san-basada-en-arm-y-alta-disponibilidad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad
- Repository: https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad

## Overview

##### Project Type and Purpose
- This is an infrastructure‐as‐code project that defines and deploys a highly available SAN (Storage Area Network) cluster on three Odroid-hc1 (ARM) boards.
- It uses Ansible to automate the installation and configuration of DRBD (block‐device replication), Pacemaker (cluster resource manager), and iSCSI (exporting block devices to clients).

##### File Structure Analysis
- Top level:
- Markdown docs (design rationale, installation manuals, conclusions).
- Ansible directory (ansible.cfg, hosts inventory, roles folder, site.yml).
- recursos/scripts (benchmarking scripts).
- ansible/roles:
- commons – common host setup (hosts file, basic packages).
- drbd – DRBD resource definition, synchronization scripts.
- pacemaker – cluster configuration scripts, resource start/stop.
- site.yml orchestrates the run‐order of these roles across the three target nodes.

##### README Insights
- Three‐node ARM cluster for low‐power, scalable, HA storage.
- Ubuntu 20.04 LTS on each Odroid-hc1.
- DRBD for real‐time block replication.
- Pacemaker for failover and resource orchestration.
- iSCSI to expose LUNs to external clients.
- Optional future: advanced filesystem, monitoring stack, extended Ansible recipes.

a. Main Components
- Ansible Control Host (could be your laptop or a dedicated management VM)
- Three ARM Storage Nodes (Node-A, Node-B, Node-C)
- Network Segments:
- Management Network (SSH/Ansible control)
- DRBD Replication Network (private, for block‐device sync)
- Client Network (iSCSI‐client traffic)
- DRBD Block Devices (one on each node, forming a replicated resource)
- Pacemaker Cluster Service (running on each node, monitoring DRBD, managing failover)
- iSCSI Target Service (running on active node(s), exporting LUNs)
- Client Machines (ESXi, Linux, etc., consuming the iSCSI LUN)

b. Relationships and Interactions
- Ansible → (SSH) → All Nodes: pushes “commons” → DRBD → Pacemaker roles.
- Nodes ↔ Nodes (Replication Network): DRBD streaming of data between block devices.
- Nodes ↔ Nodes (Heartbeat/Corosync if used internally): Pacemaker cluster communication.
- Active Node → Clients: iSCSI connections for storage I/O.

c. Architectural Patterns & Design Principles
- Infrastructure as Code: roles for repeatable, idempotent configuration.
- High Availability Cluster: DRBD provides data redundancy; Pacemaker handles automatic failover.
- Separation of Planes:
- Control Plane – Ansible orchestration
- Data Plane – DRBD replication & iSCSI traffic
- Management Plane – Pacemaker/Corosync cluster heartbeats

d. Key Technologies
- Ansible (playbooks, roles)
- DRBD (Linux kernel module + userland)
- Pacemaker (cluster resource manager)
- iSCSI Target (e.g., tgt or LIO)
- Ubuntu 20.04 LTS on Odroid-hc1 (ARM architecture)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Ansible Control Host and Files
    subgraph "Ansible Control Host" 
        direction TB
        CH["Ansible Control Host"]:::control
        cfg["ansible.cfg"]:::file
        hostsInv["hosts (inventory)"]:::file
        site["site.yml"]:::file
        subgraph "Ansible Roles"
            direction TB
            commonsTasks["commons/tasks/main.yml"]:::file
            commonsHostsFile["commons/files/etc/hosts"]:::file
            drbdTasks["drbd/tasks/main.yml"]:::file
            drbdRes["drbd/files/hadisk.res"]:::file
            drbdSync["drbd/files/sincro.bash"]:::file
            pacTasks["pacemaker/tasks/main.yml"]:::file
            pacConfig["pacemaker/files/cluster_config.bash"]:::file
            pacStart["pacemaker/files/cluster_start.bash"]:::file
        end
    end

    %% Benchmarking Scripts
    Benchmark["samba-benchmark.bash"]:::file

    %% Documentation
    subgraph "Project Documentation"
        direction TB
        README["README.md"]:::file
        InstalAnsible["Instalación-con-Ansible.md"]:::file
        InstalManual["Instalación-Manual.md"]:::file
        Entorno["Entorno-Virtual.md"]:::file
        ARMDocs["Características-y-ventajas-de-ARM.md"]:::file
        Conclusion["Conclusión.md"]:::file
    end

    %% Storage Nodes and Cluster
    subgraph "Pacemaker Cluster" 
        direction TB
        subgraph "Node-A" 
            direction TB
            A_Node["Node-A"]:::server
            A_DB["/dev/drbd0 (r0)"]:::database
            A_ISCSI["iSCSI Target"]:::service
        end
        subgraph "Node-B" 
            direction TB
            B_Node["Node-B"]:::server
            B_DB["/dev/drbd0 (r0)"]:::database
            B_ISCSI["iSCSI Target"]:::service
        end
        subgraph "Node-C" 
            direction TB
            C_Node["Node-C"]:::server
            C_DB["/dev/drbd0 (r0)"]:::database
            C_ISCSI["iSCSI Target"]:::service
        end
    end

    %% Clients
    subgraph "Clients" 
        direction TB
        Client1["ESXi Host"]:::client
        Client2["Linux VM"]:::client
    end

    %% Connections
    CH -->|"SSH (Management Network)"| A_Node
    CH -->|"SSH (Management Network)"| B_Node
    CH -->|"SSH (Management Network)"| C_Node

    A_DB <-->|"DRBD Replication Network"| B_DB
    B_DB <-->|"DRBD Replication Network"| C_DB

    A_Node ---|"Corosync Heartbeat"| B_Node
    B_Node ---|"Corosync Heartbeat"| C_Node
    C_Node ---|"Corosync Heartbeat"| A_Node

    A_ISCSI -->|"iSCSI Client Network"| Client1
    A_ISCSI -->|"iSCSI Client Network"| Client2

    %% Benchmark link
    CH ---|"runs"| Benchmark

    %% Documentation link
    CH ---|"refers"| README

    %% Click Events
    click cfg "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/ansible.cfg"
    click hostsInv "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/tree/master/ansible/hosts"
    click site "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/site.yml"
    click commonsTasks "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/roles/commons/tasks/main.yml"
    click commonsHostsFile "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/tree/master/ansible/roles/commons/files/etc/hosts"
    click drbdTasks "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/roles/drbd/tasks/main.yml"
    click drbdRes "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/roles/drbd/files/hadisk.res"
    click drbdSync "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/roles/drbd/files/sincro.bash"
    click pacTasks "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/roles/pacemaker/tasks/main.yml"
    click pacConfig "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/roles/pacemaker/files/cluster_config.bash"
    click pacStart "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/ansible/roles/pacemaker/files/cluster_start.bash"
    click Benchmark "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/recursos/scripts/samba-benchmark.bash"
    click README "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/README.md"
    click InstalAnsible "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/Instalación-con-Ansible.md"
    click InstalManual "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/Instalación-Manual.md"
    click Entorno "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/Entorno-Virtual.md"
    click ARMDocs "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/Características-y-ventajas-de-ARM.md"
    click Conclusion "https://github.com/luisaostuff/san-basada-en-arm-y-alta-disponibilidad/blob/master/Conclusión.md"

    %% Styles
    classDef control fill:#AED6F1,stroke:#21618C,color:#1B4F72
    classDef server fill:#A9DFBF,stroke:#145A32,color:#0B5345
    classDef database fill:#F9E79F,stroke:#B9770E,color:#7E5109
    classDef service fill:#EBDEF0,stroke:#7D3C98,color:#4A235A
    classDef client fill:#FADBD8,stroke:#922B21,color:#641E16
    classDef file fill:#D6EAF8,stroke:#1A5276,color:#154360
```
