# 09anshu/infraops architecture

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

- Interactive diagram: https://gitdiagram.com/09anshu/infraops
- Repository: https://github.com/09anshu/infraops

## Overview

#### Purpose and Operating Model
This is an Ansible-based two-tier deployment lab: a WSL/Linux control node connects over SSH to an Ubuntu VM managed node and provisions web and database services. The repository also contains a prebuilt static Next.js export intended for web serving. Core entry points are `site.yml`, `web.yml`, and `db.yml`.

#### Control Plane and Targeting
Ansible runs from the control node using repository configuration and a static inventory. Target host/group selection and SSH connectivity begin at `ansible.cfg` and `inventory/hosts.ini`. The external boundary is OpenSSH from WSL to the VMware-hosted Ubuntu 24.04 managed node; credentials, host addresses, and access policy are environment-specific rather than application-managed.

#### Playbook Orchestration
`site.yml` is the likely top-level composition point for the deployment, while `web.yml` and `db.yml` separate web-server and database-server execution paths. This establishes a role-oriented control flow: select inventory hosts, apply the appropriate playbook, then execute role task graphs remotely. Paths: `site.yml`, `web.yml`, `db.yml`.

#### Web Serving Stage
The `webserver` role owns host setup, service configuration, and delivery of web content. Its task and handler layers define provisioning actions and service lifecycle reactions; its template provides server-rendered/configured HTML content. The deployable site artifact is under `out/`, including static HTML and Next.js client assets. Paths: `roles/webserver/tasks/main.yml`, `roles/webserver/handlers/main.yml`, `roles/webserver/templates/index.html.j2`.

#### Database Stage
The `dbserver` role independently provisions and manages the database tier. Defaults and vars provide role-scoped inputs, tasks implement the installation/configuration flow, and handlers apply service changes after state transitions. No application-level schema, ORM, or API source is present, so the database role is infrastructure-facing rather than coupled to a backend service. Paths: `roles/dbserver/tasks/main.yml`, `roles/dbserver/handlers/main.yml`, `roles/dbserver/defaults/main.yml`.

#### Static Frontend Boundary
`out/` is an already-generated frontend distribution, not source for the application. It includes entry HTML (`out/index.html`), fallback pages, and hashed JavaScript/CSS assets under `out/_next/static/`. The web-server deployment boundary is therefore between Ansible-managed host configuration and these static files; runtime browser behavior executes client-side through the exported Next.js bundles. Paths: `out/index.html`, `out/_next/static`, `out/_not-found.html`.

#### Runtime and Infrastructure
Material runtimes are Ansible/Python on the control node, SSH on the transport boundary, Ubuntu on VMware as the managed runtime, and a web/database service pair configured by roles. VS Code Remote WSL/SSH is a development interface only. Role metadata and defaults make each service role independently reusable while inventory/playbooks bind them to this lab environment. Paths: `roles/webserver/meta/main.yml`, `roles/dbserver/meta/main.yml`, `inventory/hosts.ini`.

Main entry points: [`roles/webserver/tasks/main.yml`](https://github.com/09anshu/infraops/blob/main/roles/webserver/tasks/main.yml) (Webserver Tasks), [`roles/dbserver/tasks/main.yml`](https://github.com/09anshu/infraops/blob/main/roles/dbserver/tasks/main.yml) (Database Tasks), [`site.yml`](https://github.com/09anshu/infraops/blob/main/site.yml) (Site Playbook), [`inventory/hosts.ini`](https://github.com/09anshu/infraops/blob/main/inventory/hosts.ini) (Static Inventory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Ansible Control Node"]
  node_ansible_config["Ansible Configuration<br/>[ansible.cfg]"]
  node_inventory["Static Inventory<br/>[hosts.ini]"]
  node_site_playbook["Site Playbook<br/>[site.yml]"]
  node_web_playbook["Web Playbook<br/>[web.yml]"]
  node_db_playbook["Database Playbook<br/>[db.yml]"]
end

subgraph group_managed["Ubuntu Managed Node"]
  node_web_tasks["Webserver Tasks<br/>Ansible role<br/>[main.yml]"]
  node_web_handlers["Web Service Handlers<br/>Ansible handlers<br/>[main.yml]"]
  node_web_template["Web Template<br/>Jinja template<br/>[index.html.j2]"]
  node_web_metadata["Web Role Metadata<br/>[main.yml]"]
  node_web_service["Web Service<br/>runtime service"]
  node_db_tasks["Database Tasks<br/>Ansible role<br/>[main.yml]"]
  node_db_defaults["Database Defaults<br/>role defaults<br/>[main.yml]"]
  node_db_handlers["Database Service Handlers<br/>Ansible handlers<br/>[main.yml]"]
  node_db_metadata["Database Role Metadata<br/>[main.yml]"]
  node_database_service[("Database Service<br/>runtime service")]
end

subgraph group_frontend["Static Frontend Export"]
  node_frontend_entry["Static Entry HTML<br/>Next.js export<br/>[index.html]"]
  node_next_assets["Next.js Client Assets<br/>static assets"]
  node_not_found_page["Static Fallback Page<br/>Next.js export<br/>[_not-found.html]"]
end

node_ssh{{"OpenSSH Boundary<br/>transport"}}

node_ansible_config -->|"loads"| node_inventory
node_inventory -->|"targets host over"| node_ssh
node_site_playbook -->|"composes"| node_web_playbook
node_site_playbook -->|"composes"| node_db_playbook
node_web_playbook -->|"executes through"| node_ssh
node_db_playbook -->|"executes through"| node_ssh
node_ssh -->|"runs remotely"| node_web_tasks
node_ssh -->|"runs remotely"| node_db_tasks
node_web_tasks -->|"renders"| node_web_template
node_web_tasks -.->|"notifies"| node_web_handlers
node_web_handlers -->|"manages"| node_web_service
node_frontend_entry -->|"deployed for serving"| node_web_service
node_next_assets -->|"referenced by"| node_frontend_entry
node_not_found_page -->|"served as fallback"| node_web_service
node_db_defaults -->|"configures"| node_db_tasks
node_db_tasks -.->|"notifies"| node_db_handlers
node_db_handlers -->|"manages"| node_database_service

click node_ansible_config "https://github.com/09anshu/infraops/blob/main/ansible.cfg"
click node_inventory "https://github.com/09anshu/infraops/blob/main/inventory/hosts.ini"
click node_site_playbook "https://github.com/09anshu/infraops/blob/main/site.yml"
click node_web_playbook "https://github.com/09anshu/infraops/blob/main/web.yml"
click node_db_playbook "https://github.com/09anshu/infraops/blob/main/db.yml"
click node_web_tasks "https://github.com/09anshu/infraops/blob/main/roles/webserver/tasks/main.yml"
click node_web_handlers "https://github.com/09anshu/infraops/blob/main/roles/webserver/handlers/main.yml"
click node_web_template "https://github.com/09anshu/infraops/blob/main/roles/webserver/templates/index.html.j2"
click node_web_metadata "https://github.com/09anshu/infraops/blob/main/roles/webserver/meta/main.yml"
click node_db_tasks "https://github.com/09anshu/infraops/blob/main/roles/dbserver/tasks/main.yml"
click node_db_defaults "https://github.com/09anshu/infraops/blob/main/roles/dbserver/defaults/main.yml"
click node_db_handlers "https://github.com/09anshu/infraops/blob/main/roles/dbserver/handlers/main.yml"
click node_db_metadata "https://github.com/09anshu/infraops/blob/main/roles/dbserver/meta/main.yml"
click node_frontend_entry "https://github.com/09anshu/infraops/blob/main/out/index.html"
click node_next_assets "https://github.com/09anshu/infraops/tree/main/out/_next/static"
click node_not_found_page "https://github.com/09anshu/infraops/blob/main/out/_not-found.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ansible_config,node_inventory,node_site_playbook,node_web_playbook,node_db_playbook toneBlue
class node_web_tasks,node_web_handlers,node_web_template,node_web_metadata,node_web_service,node_db_tasks,node_db_defaults,node_db_handlers,node_db_metadata,node_database_service toneAmber
class node_frontend_entry,node_next_assets,node_not_found_page toneMint
class node_ssh toneNeutral
```

## Components

### Ansible Control Node

WSL/Linux runs Ansible and selects managed hosts.

- [Ansible Configuration](https://github.com/09anshu/infraops/blob/main/ansible.cfg): config · `ansible.cfg`
- [Static Inventory](https://github.com/09anshu/infraops/blob/main/inventory/hosts.ini): inventory · `inventory/hosts.ini`
- [Site Playbook](https://github.com/09anshu/infraops/blob/main/site.yml): playbook · Top-level deployment composition. · `site.yml`
- [Web Playbook](https://github.com/09anshu/infraops/blob/main/web.yml): playbook · `web.yml`
- [Database Playbook](https://github.com/09anshu/infraops/blob/main/db.yml): playbook · `db.yml`

### Ubuntu Managed Node

Ubuntu 24.04 VM hosts the provisioned service tiers.

- [Webserver Tasks](https://github.com/09anshu/infraops/blob/main/roles/webserver/tasks/main.yml): Ansible role · Provisions web host and deploys content. · `roles/webserver/tasks/main.yml`
- [Web Service Handlers](https://github.com/09anshu/infraops/blob/main/roles/webserver/handlers/main.yml): Ansible handlers · Applies web service lifecycle changes. · `roles/webserver/handlers/main.yml`
- [Web Template](https://github.com/09anshu/infraops/blob/main/roles/webserver/templates/index.html.j2): Jinja template · `roles/webserver/templates/index.html.j2`
- [Web Role Metadata](https://github.com/09anshu/infraops/blob/main/roles/webserver/meta/main.yml): role metadata · Supports independent role reuse. · `roles/webserver/meta/main.yml`
- **Web Service**: runtime service · Serves configured HTML and static frontend files.
- [Database Tasks](https://github.com/09anshu/infraops/blob/main/roles/dbserver/tasks/main.yml): Ansible role · Installs and configures the database tier. · `roles/dbserver/tasks/main.yml`
- [Database Defaults](https://github.com/09anshu/infraops/blob/main/roles/dbserver/defaults/main.yml): role defaults · `roles/dbserver/defaults/main.yml`
- [Database Service Handlers](https://github.com/09anshu/infraops/blob/main/roles/dbserver/handlers/main.yml): Ansible handlers · Applies database service changes. · `roles/dbserver/handlers/main.yml`
- [Database Role Metadata](https://github.com/09anshu/infraops/blob/main/roles/dbserver/meta/main.yml): role metadata · Supports independent role reuse. · `roles/dbserver/meta/main.yml`
- **Database Service**: runtime service · Infrastructure-facing database with no application schema or API layer.

### Static Frontend Export

Prebuilt Next.js distribution served as static content.

- [Static Entry HTML](https://github.com/09anshu/infraops/blob/main/out/index.html): Next.js export · `out/index.html`
- [Next.js Client Assets](https://github.com/09anshu/infraops/tree/main/out/_next/static): static assets · Hashed JavaScript and CSS executed in the browser. · `out/_next/static`
- [Static Fallback Page](https://github.com/09anshu/infraops/blob/main/out/_not-found.html): Next.js export · `out/_not-found.html`

### Other components

- **OpenSSH Boundary**: transport · Environment-managed SSH access from WSL to the VM.

## Connections

- Ansible Configuration → Static Inventory: loads
- Static Inventory → OpenSSH Boundary: targets host over
- Site Playbook → Web Playbook: composes
- Site Playbook → Database Playbook: composes
- Web Playbook → OpenSSH Boundary: executes through
- Database Playbook → OpenSSH Boundary: executes through
- OpenSSH Boundary → Webserver Tasks: runs remotely
- OpenSSH Boundary → Database Tasks: runs remotely
- Webserver Tasks → Web Template: renders
- Webserver Tasks → Web Service Handlers: notifies
- Web Service Handlers → Web Service: manages
- Static Entry HTML → Web Service: deployed for serving
- Next.js Client Assets → Static Entry HTML: referenced by
- Static Fallback Page → Web Service: served as fallback
- Database Defaults → Database Tasks: configures
- Database Tasks → Database Service Handlers: notifies
- Database Service Handlers → Database Service: manages
