Skip to content

Commit c3a3147

Browse files
ismoilovdevmlclaude
andcommitted
[NEW] Add modern Ansible Dashboard with dark/green theme
Features: - 🎨 Modern dark theme with green accents - πŸ“ Browse 43+ Ansible folders with search - πŸ“ Edit inventory.ini and vars.yml files - ▢️ Run playbooks with one click - πŸ“Š Real-time execution output - πŸ’Ύ Save variables and inventory - πŸ”„ Auto-refresh job status Tech Stack: - Backend: FastAPI + Python 3.11 - Frontend: React + TypeScript + Vite + Tailwind CSS - DevOps: Docker Compose + Molecule tests - API: RESTful endpoints for folder/vars/inventory management Tested: - βœ… Vars save (Form & YAML mode) - βœ… Inventory save - βœ… Folder listing (43 folders) - βœ… Search functionality - βœ… Container networking - βœ… Volume mount (read-write) - βœ… Backend API endpoints - βœ… Frontend proxy configuration πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 82f52af commit c3a3147

23 files changed

+1276
-0
lines changed

β€Ždashboard/.gitignoreβ€Ž

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
venv/
8+
env/
9+
*.egg-info/
10+
11+
# Node
12+
node_modules/
13+
dist/
14+
build/
15+
*.log
16+
.DS_Store
17+
18+
# IDEs
19+
.vscode/
20+
.idea/
21+
*.swp
22+
*.swo
23+
24+
# Molecule
25+
.molecule/
26+
.cache/
27+
28+
# Environment
29+
.env
30+
.env.local

β€Ždashboard/README.mdβ€Ž

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Ansible Dashboard
2+
3+
Modern web dashboard for managing and running Ansible playbooks.
4+
5+
## Features
6+
7+
- πŸ“ Browse all Ansible folders
8+
- πŸ“ Edit inventory.ini and vars.yml files
9+
- ▢️ Run playbooks with one click
10+
- πŸ“Š Real-time execution output
11+
- πŸ”„ Auto-refresh job status
12+
- 🎨 Modern, responsive UI
13+
14+
## Prerequisites
15+
16+
- Python 3.11+
17+
- Node.js 20+
18+
- Docker & Docker Compose (for containerized deployment)
19+
- Ansible installed (for local development)
20+
21+
## Quick Start
22+
23+
### Using Docker Compose (Recommended)
24+
25+
```bash
26+
cd dashboard
27+
docker-compose up -d
28+
```
29+
30+
Access the dashboard at:
31+
- Frontend: http://localhost:3000
32+
- Backend API: http://localhost:8000
33+
34+
### Local Development
35+
36+
#### Backend
37+
38+
```bash
39+
cd dashboard/backend
40+
pip install -r requirements.txt
41+
python app.py
42+
```
43+
44+
Backend will run on http://localhost:8000
45+
46+
#### Frontend
47+
48+
```bash
49+
cd dashboard/frontend
50+
npm install
51+
npm run dev
52+
```
53+
54+
Frontend will run on http://localhost:3000
55+
56+
## Tested Features βœ…
57+
58+
The dashboard has been fully tested and verified working:
59+
60+
- βœ… Docker Compose build and deployment
61+
- βœ… Backend API serving on port 8000
62+
- βœ… Frontend serving on port 3000 (Modern Dark/Green Theme)
63+
- βœ… Container networking (backend ↔ frontend proxy)
64+
- βœ… Ansible folder scanning (43 folders detected)
65+
- βœ… Inventory.ini parsing and editing
66+
- βœ… Vars.yml parsing and editing (Form + YAML mode)
67+
- βœ… Playbook listing and selection
68+
- βœ… Real-time job execution and output
69+
70+
### UI Features
71+
72+
- 🎨 Modern dark theme with green accents
73+
- πŸ” Folder search functionality
74+
- πŸ“ Dual-mode variable editor (Form & YAML)
75+
- πŸ’Ύ Save inventory and variables
76+
- ▢️ One-click playbook execution
77+
- πŸ“Š Real-time execution output with status
78+
- πŸ“± Responsive design
79+
80+
### Test Results
81+
82+
```bash
83+
# Backend API Test
84+
curl http://localhost:8000/api/folders | jq 'length'
85+
# Returns: 43
86+
87+
# Keepalived Vars Test
88+
curl http://localhost:8000/api/folders/keepalived/vars | jq '.content | keys'
89+
# Returns: ["advert_int", "auth_pass", "interface", "master_priority",
90+
# "slave_priority", "virtual_ipaddress", "virtual_router_id"]
91+
92+
# Keepalived Inventory Test
93+
curl http://localhost:8000/api/folders/keepalived/inventory
94+
# Returns: master and slave groups with hosts
95+
```
96+
97+
### Screenshots
98+
99+
Frontend displays:
100+
- Left sidebar: 43 Ansible folders with search
101+
- Main panel: Playbook execution, variables editor, inventory editor
102+
- Terminal output: Real-time Ansible execution logs
103+
- Theme: Dark gray background with green highlights
104+
105+
## Testing with Molecule (Optional)
106+
107+
```bash
108+
cd dashboard
109+
pip install molecule molecule-docker ansible-core
110+
molecule test
111+
```
112+
113+
## Usage
114+
115+
1. **Select Folder**: Choose an Ansible folder from the left sidebar
116+
2. **Edit Variables**: Modify vars.yml using form or YAML editor
117+
3. **Edit Inventory**: Update inventory.ini file if needed
118+
4. **Select Playbook**: Choose which playbook to run
119+
5. **Run**: Click the Run button and watch real-time output
120+
121+
## API Endpoints
122+
123+
- `GET /api/folders` - List all Ansible folders
124+
- `GET /api/folders/{name}/inventory` - Get inventory content
125+
- `GET /api/folders/{name}/vars` - Get variables content
126+
- `POST /api/folders/{name}/inventory` - Update inventory
127+
- `POST /api/folders/{name}/vars` - Update variables
128+
- `POST /api/run` - Execute playbook
129+
- `GET /api/jobs/{id}` - Get job status
130+
- `GET /api/jobs` - List all jobs
131+
132+
## Architecture
133+
134+
```
135+
dashboard/
136+
β”œβ”€β”€ backend/ # FastAPI backend
137+
β”‚ β”œβ”€β”€ app.py # Main API application
138+
β”‚ β”œβ”€β”€ requirements.txt
139+
β”‚ └── Dockerfile
140+
β”œβ”€β”€ frontend/ # React + TypeScript frontend
141+
β”‚ β”œβ”€β”€ src/
142+
β”‚ β”‚ β”œβ”€β”€ App.tsx # Main component
143+
β”‚ β”‚ └── main.tsx
144+
β”‚ β”œβ”€β”€ package.json
145+
β”‚ └── Dockerfile
146+
β”œβ”€β”€ molecule/ # Molecule tests
147+
β”‚ └── default/
148+
β”‚ β”œβ”€β”€ molecule.yml
149+
β”‚ β”œβ”€β”€ converge.yml
150+
β”‚ └── verify.yml
151+
└── docker-compose.yml
152+
```
153+
154+
## Security Notes
155+
156+
- This dashboard is intended for internal use only
157+
- Ensure proper network security and access controls
158+
- SSH keys should be properly managed
159+
- Inventory files may contain sensitive information
160+
161+
## License
162+
163+
MIT

β€Ždashboard/backend/Dockerfileβ€Ž

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /app
4+
5+
# Install system dependencies including Ansible
6+
RUN apt-get update && \
7+
apt-get install -y --no-install-recommends \
8+
ansible \
9+
openssh-client \
10+
sshpass \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# Copy requirements and install Python packages
14+
COPY requirements.txt .
15+
RUN pip install --no-cache-dir -r requirements.txt
16+
17+
# Copy application code
18+
COPY . .
19+
20+
EXPOSE 8000
21+
22+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]

0 commit comments

Comments
Β (0)