# learnlinuxtv/getting_started_with_ansible architecture

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

- Interactive diagram: https://gitdiagram.com/learnlinuxtv/getting_started_with_ansible
- Repository: https://github.com/learnlinuxtv/getting_started_with_ansible

## Overview

##### Project type and purpose
- This is an Ansible-based Infrastructure-as-Code project. Its purpose is to automate the provisioning and configuration of a set of Linux hosts (web servers, database servers, file servers, and workstations) using Ansible playbooks and roles.

##### File structure
- Top-level files:
- ansible.cfg – configuration for the Ansible control node
- inventory – list of target hosts or host groups
- site.yml, bootstrap.yml, install_apache.yml, remove_apache.yml – playbooks that orchestrate various tasks
- host_vars/ – per-host variable overrides
- roles/ – reusable role definitions, each with:
- tasks/main.yml
- handlers/main.yml
- files/ and templates/ (Jinja2 templates)
- .files/ for static file distribution
- files/ – project-wide static files (e.g. default_site.html)
- roles folder subdivided into base, db_servers, file_servers, web_servers, workstations

##### Insights from the README
- This repo is part of a tutorial series on getting started with Ansible.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Control Node and Configurations
    subgraph "Ansible Control Node"
        direction TB
        ControlNode["Ansible Control Node"]:::control
        CFG["ansible.cfg"]:::config
    end
    ControlNode --> CFG
    ControlNode --> Inventory
    ControlNode --> HostVars

    %% Inventory and Host Vars
    Inventory["Inventory"]:::config
    HostVars["host_vars/"]:::hostcfg

    click CFG "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/ansible.cfg"
    click Inventory "https://github.com/learnlinuxtv/getting_started_with_ansible/tree/master/inventory"
    click HostVars "https://github.com/learnlinuxtv/getting_started_with_ansible/tree/master/host_vars/"

    %% Playbooks
    subgraph "Playbooks" 
        direction TB
        SiteBefore["site_before_roles.yml"]:::playbook
        Site["site.yml"]:::playbook
        Bootstrap["bootstrap.yml"]:::playbook
        InstallApache["install_apache.yml"]:::playbook
        RemoveApache["remove_apache.yml"]:::playbook
    end
    click SiteBefore "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/site_before_roles.yml"
    click Site "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/site.yml"
    click Bootstrap "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/bootstrap.yml"
    click InstallApache "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/install_apache.yml"
    click RemoveApache "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/remove_apache.yml"

    Inventory --> SiteBefore
    Inventory --> Site
    Inventory --> Bootstrap
    Inventory --> InstallApache
    Inventory --> RemoveApache

    %% Roles
    subgraph "Roles"
        direction TB
        subgraph "base" 
            direction TB
            BaseTasks["tasks/main.yml"]:::role
            BaseTemplates["templates (sshd_config_centos.j2, sshd_config_ubuntu.j2)"]:::template
            BaseHandlers["handlers/main.yml"]:::handler
            BaseFiles[".files/sudoer_simone"]:::files
        end
        subgraph "web_servers"
            direction TB
            WebTasks["tasks/main.yml"]:::role
            WebHandlers["handlers/main.yml"]:::handler
            WebFiles["files/default_site.html"]:::files
        end
        subgraph "db_servers"
            direction TB
            DbTasks["tasks/main.yml"]:::role
        end
        subgraph "file_servers"
            direction TB
            FileTasks["tasks/main.yml"]:::role
        end
        subgraph "workstations"
            direction TB
            WorkTasks["tasks/main.yml"]:::role
        end
    end

    %% Click events for roles
    click BaseTasks "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/base/tasks/main.yml"
    click BaseTemplates "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/base/templates/sshd_config_centos.j2"
    click BaseTemplates "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/base/templates/sshd_config_ubuntu.j2"
    click BaseHandlers "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/base/handlers/main.yml"
    click BaseFiles "https://github.com/learnlinuxtv/getting_started_with_ansible/tree/master/roles/base/.files/sudoer_simone"
    click WebTasks "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/web_servers/tasks/main.yml"
    click WebHandlers "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/web_servers/handlers/main.yml"
    click WebFiles "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/web_servers/files/default_site.html"
    click DbTasks "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/db_servers/tasks/main.yml"
    click FileTasks "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/file_servers/tasks/main.yml"
    click WorkTasks "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/roles/workstations/tasks/main.yml"
    click StaticFiles "https://github.com/learnlinuxtv/getting_started_with_ansible/blob/master/files/default_site.html"
    click StaticFiles2 "https://github.com/learnlinuxtv/getting_started_with_ansible/tree/master/files/sudoer_simone"

    %% Connections from Playbooks to Roles
    SiteBefore --> BaseTasks
    Bootstrap --> BaseTasks
    Site --> BaseTasks
    Site --> WebTasks
    Site --> DbTasks
    Site --> FileTasks
    Site --> WorkTasks
    InstallApache --> WebTasks
    RemoveApache --> WebTasks

    InstallApache --> WebHandlers
    WebTasks --> WebHandlers
    WebTasks --> WebFiles

    BaseTasks --> BaseTemplates
    BaseTasks --> BaseFiles
    BaseTasks --> BaseHandlers

    %% Managed Hosts
    subgraph "Managed Hosts"
        direction TB
        WebHosts["Web Servers"]:::host
        DbHosts["DB Servers"]:::host
        FileHosts["File Servers"]:::host
        WorkHosts["Workstations"]:::host
    end

    %% Role application to Hosts
    BaseTasks --> WebHosts
    BaseTasks --> DbHosts
    BaseTasks --> FileHosts
    BaseTasks --> WorkHosts

    WebTasks --> WebHosts
    DbTasks --> DbHosts
    FileTasks --> FileHosts
    WorkTasks --> WorkHosts

    HostVars --> WebHosts
    HostVars --> DbHosts
    HostVars --> FileHosts
    HostVars --> WorkHosts

    %% Styles
    classDef control fill:#B3D1FF,stroke:#1F77B4,color:#000
    classDef config fill:#FFE4B3,stroke:#FF8C00,color:#000
    classDef hostcfg fill:#FFF2CC,stroke:#D8B365,color:#000
    classDef playbook fill:#C6E2FF,stroke:#3399FF,color:#000
    classDef role fill:#D5FFD5,stroke:#27A627,color:#000
    classDef template fill:#E8E8E8,stroke:#7F7F7F,color:#000
    classDef handler fill:#FFF0F5,stroke:#DB7093,color:#000
    classDef files fill:#F5F5DC,stroke:#CD853F,color:#000
    classDef host fill:#FFEFD5,stroke:#FF7F50,color:#000
```
