# eamartin96/ansible architecture

> Architecture diagram of the GitHub repository eamartin96/ansible, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eamartin96/ansible
- Repository: https://github.com/eamartin96/ansible

## Overview

##### Main Components
- Ansible Control Node: This is the local (or designated) machine where Ansible is installed and configured. It uses the ansible.cfg and inventory.yml files to know about the target hosts.
- Docker Engine & Docker Compose: These are responsible for building and running the Docker containers. The build_images.sh script and docker-compose.yml file orchestrate container creation.
- Docker Images and Containers: Under the Docker directory, two Dockerfiles (one for Debian, one for Ubuntu) are used to build images. The containers are then the cluster nodes where the playbooks (found in the playbooks folder such as apache.yml, docker.yml, mysql.yml, users.yml) run.
- SSH Keys: The generate_keys.sh script indicates that secure (SSH) access is a fundamental part of how Ansible will connect to these containers.

##### Architectural Patterns & Key Technologies
- The project follows a separation of concerns typical for a full-stack or distributed system simulation: The control plane (Ansible) is clearly separated from the data plane (the containerized virtual nodes).
- The use of Docker Compose indicates that the containers are managed as a single multi-container application.
- SSH-based communication from Ansible to each container emphasizes a secure remote management pattern.
- Ansible’s modular playbooks demonstrate a layered/role-based configuration style.

- Use clear labels for each of the following components:
- Ansible Control Node (with ansible.cfg, inventory.yml, and playbooks)
- Docker Engine / Docker Compose layer
- Docker images (Debian-based and Ubuntu-based images indicated by the Docker folder files)
- Containerized nodes (each representing a virtual machine in the cluster)
- From the build scripts (build_images.sh) and SSH keys (generate_keys.sh) to their respective roles in setting up the environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Ansible Control Node"
        AC1["ansible.cfg"]:::config
        AC2["inventory.yml"]:::config
        AC3["Playbooks"]:::config
    end

    subgraph "Docker Engine & Compose"
        DC1["docker-compose.yml"]:::compose
        DC2["build_images.sh"]:::build
    end

    subgraph "Docker Images & Containers"
        DI1["Debian Image (Dockerfile.debian)"]:::dockerimg
        DI2["Ubuntu Image (Dockerfile.ubuntu)"]:::dockerimg
        CN1["Container Node (Debian)"]:::container
        CN2["Container Node (Ubuntu)"]:::container
    end

    subgraph "SSH Key Management"
        SK["generate_keys.sh"]:::script
    end

    %% Flow Connections
    SK -->|"generate_keys"| AC1
    DC2 -->|"builds_images"| DI1
    DC2 -->|"builds_images"| DI2
    DI1 -->|"creates_container"| CN1
    DI2 -->|"creates_container"| CN2
    DC1 -->|"orchestrates"| CN1
    DC1 -->|"orchestrates"| CN2
    AC3 -->|"applies_playbook"| CN1
    AC3 -->|"applies_playbook"| CN2
    AC1 -->|"SSH_access"| CN1
    AC1 -->|"SSH_access"| CN2

    %% Click Events
    click AC1 "https://github.com/eamartin96/ansible/blob/main/ansible.cfg"
    click AC2 "https://github.com/eamartin96/ansible/blob/main/inventory.yml"
    click AC3 "https://github.com/eamartin96/ansible/tree/main/playbooks/"
    click DC1 "https://github.com/eamartin96/ansible/blob/main/docker-compose.yml"
    click DC2 "https://github.com/eamartin96/ansible/blob/main/build_images.sh"
    click DI1 "https://github.com/eamartin96/ansible/blob/main/Docker/Dockerfile.debian"
    click DI2 "https://github.com/eamartin96/ansible/blob/main/Docker/Dockerfile.ubuntu"
    click SK "https://github.com/eamartin96/ansible/blob/main/generate_keys.sh"

    %% Styles
    classDef config fill:#a8dadc,stroke:#457b9d,stroke-width:2px;
    classDef compose fill:#f4a261,stroke:#e76f51,stroke-width:2px;
    classDef build fill:#ffca3a,stroke:#ff9f1c,stroke-width:2px;
    classDef dockerimg fill:#90be6d,stroke:#43aa8b,stroke-width:2px;
    classDef container fill:#e9c46a,stroke:#f4a261,stroke-width:2px;
    classDef script fill:#f94144,stroke:#f3722c,stroke-width:2px;
```
