|
| 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 |
0 commit comments