Skip to content
Sameer Alam, home: sameeralam @infra:~$

active

AI Ansible Generator

Plain English → validated Ansible playbooks

Turns a plain-English request into an Ansible playbook, then validates YAML, syntax and safety and runs a repair loop until it passes. FastAPI + Gradio, backed by Ollama or Hugging Face models.

  • Python
  • FastAPI
  • Gradio
  • Ollama
  • Hugging Face
  • Ansible
Live demo repository is private

01 problem

Large language models can write Ansible, but raw model output can't be trusted in production: it may not be valid YAML, may not pass Ansible's own syntax checks, and may do something destructive. Pasting it into a terminal is how outages start.

02 approach

  1. 01 Treat the model as an untrusted author: everything it writes goes through validation before anyone sees it as a result.
  2. 02 Validate in layers: YAML parsing, Ansible syntax, then safety rules for risky patterns.
  3. 03 When validation fails, feed the errors back to the model in a repair loop instead of handing the user a broken playbook.
  4. 04 Keep the model pluggable: run locally with Ollama or use hosted models through Hugging Face.
  5. 05 Serve it two ways: a FastAPI backend for programmatic use and a Gradio interface for people.

03 architecture

AI Ansible Generator — generate, validate, repair select a step
  1. 01 · request

  2. 02 · generate

  3. 03 · validate

  4. 04 · repair

  5. 05 · result

trigger · gradio ui · fastapi

plain-English request

A person describes the automation they want in plain English through the Gradio interface, or a client calls the FastAPI backend.

All steps as text
  1. 1. request

    • plain-English request: A person describes the automation they want in plain English through the Gradio interface, or a client calls the FastAPI backend.
  2. 2. generate

    • LLM: The request is turned into a draft playbook by a local model through Ollama or a hosted model through Hugging Face. Either way, the draft is treated as untrusted.
  3. 3. validate

    • YAML check: The draft must parse as YAML before anything else happens.
    • syntax check: The playbook must pass Ansible syntax validation.
    • safety rules: Safety checks flag dangerous operations before the playbook is returned.
  4. 4. repair

    • repair loop: If any check fails, the validation errors go back to the model with the draft so it can fix them, and the result is validated again.
  5. 5. result

    • validated playbook: Only a playbook that passed every check is returned to the user or API client.

04 outcome

  • Plain-English requests become Ansible playbooks that have passed YAML, syntax and safety validation.
  • A live demo runs on Hugging Face Spaces.

Sections

Principles#principles
Stack#stack
Projects#projects
GitHub#github
Incident#incident
Architecture#architecture
Status#status
Experience#experience
Credentials#credentials
Writing#writing
Contact#contact

Projects

KubeRescuedeep dive
LinuxVitalsdeep dive
IPMGdeep dive
AI Ansible Generatordeep dive

Actions

Toggle light / dark theme
Match my system theme
Copy email addresssameeralam3127@gmail.com
Download resume (.docx)
Download resume (.pdf)
GitHubsameeralam3127
LinkedInsameer-alam
Compute Centralcomputecentral.in
↑↓ navigate↵ select