Skip to content

dionipe/ansible-admin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ansible Admin Dashboard

A modern web-based interface for managing and executing Ansible playbooks with real-time monitoring and live execution output.

Features

🎯 Core Functionality

  • Playbook Management: Create, edit, and organize Ansible playbooks
  • Template System: Built-in templates and Jinja2 template support
  • Inventory Management: Dynamic host and group management
  • Real-time Execution: Live monitoring of playbook execution with streaming output
  • Execution History: Track and review past playbook runs

🎨 Enhanced Output Display

  • Unixy Callback Integration: Uses Ansible's community.general.unixy callback for condensed, readable output
  • Color-Coded Output: Syntax highlighting for different Ansible output types:
    • 🟒 OK/Success: Green highlighting
    • 🟑 Changed: Yellow highlighting
    • πŸ”΄ Failed: Red highlighting with background
    • πŸ”΅ Info: Blue for informational messages
    • 🟣 Headers: Purple for PLAY/TASK headers
    • βšͺ Skipped: Gray for skipped tasks
  • Responsive Design: Optimized for both desktop and mobile viewing

πŸ”§ Technical Features

  • Server-Sent Events: Real-time output streaming during execution
  • Background Processing: Non-blocking playbook execution
  • Error Handling: Comprehensive error reporting and recovery
  • CORS Support: Cross-origin resource sharing enabled
  • RESTful API: Clean API endpoints for all operations

Screenshots

Dashboard

Dashboard

Playbook Execution

Playbook Execution

Live Execution Output

Live Execution Output

About Modal

About Modal

Installation

Prerequisites

  • Python 3.8+
  • Ansible 2.9+
  • community.general collection (automatically installed)

Setup

  1. Clone the repository:
git clone <repository-url>
cd ansible-admin
  1. Install Python dependencies:
pip install -r requirements.txt
  1. Install Ansible collections:
ansible-galaxy collection install -r requirements.yml
  1. Start the server:
python3 server.py
  1. Open your browser to http://localhost:8000

Configuration

Ansible Configuration

The application uses a custom ansible.cfg file with the following settings:

[defaults]
stdout_callback = community.general.unixy
display_ok_hosts = true
display_skipped_hosts = true
show_task_path_on_failure = true
force_color = true

Unixy Callback Features

The unixy callback provides:

  • Condensed Output: More compact than default Ansible output
  • Color Coding: Visual distinction between different output types
  • Timing Information: Execution time for each task
  • Host Status: Clear indication of success/failure per host
  • Check Mode Support: Visual markers for dry-run mode

Usage

Running Playbooks

  1. Navigate to the Execute page
  2. Select a playbook from the dropdown or enter a custom path
  3. Configure inventory and target hosts
  4. Add any additional Ansible options
  5. Click Execute to start the playbook
  6. Monitor progress in real-time with color-coded output

Managing Templates

  • Built-in Templates: Pre-configured playbooks for common tasks
  • Jinja2 Templates: Dynamic templates with variable substitution
  • Custom Templates: Save and reuse your own templates

Monitoring Execution

  • Live Output: Real-time streaming of Ansible execution
  • Status Indicators: Visual status badges (Running, Completed, Failed)
  • Execution Timer: Track total execution time
  • Auto-scroll: Automatically scroll to latest output
  • Download Logs: Export execution logs for analysis

API Endpoints

Playbook Management

  • GET /api/list-playbooks - List available playbooks
  • POST /api/save-playbook - Save a playbook
  • POST /api/delete-playbook - Delete a playbook

Template Management

  • GET /api/list-jinja-templates - List Jinja2 templates
  • GET /api/get-jinja-template?name=<name> - Get template content

Execution

  • POST /execute-playbook - Start playbook execution
  • GET /execution-stream/<execution_id> - Stream execution output
  • POST /cancel-execution - Cancel running execution

History

  • GET /get-execution-history - Get execution history
  • GET /execution-details/<execution_id> - Get detailed execution info

Development

Project Structure

ansible-admin/
β”œβ”€β”€ server.py              # Main HTTP server
β”œβ”€β”€ ansible.cfg           # Ansible configuration with unixy callback
β”œβ”€β”€ requirements.yml      # Ansible collection requirements
β”œβ”€β”€ execute.html          # Playbook execution interface
β”œβ”€β”€ playbooks/            # Ansible playbooks directory
β”œβ”€β”€ templates/            # Jinja2 templates directory
β”œβ”€β”€ datastore/            # Data storage (JSON files)
└── static/               # Static web assets

Adding New Features

  1. Backend: Add new endpoints in server.py
  2. Frontend: Update HTML/JavaScript files
  3. Styling: Modify CSS for new UI elements
  4. Configuration: Update ansible.cfg for new Ansible settings

Troubleshooting

Common Issues

Unixy callback not working:

  • Ensure community.general collection is installed
  • Check that ansible.cfg is in the project root
  • Verify ANSIBLE_CONFIG environment variable is set

Output not streaming:

  • Check browser console for JavaScript errors
  • Verify Server-Sent Events are supported
  • Check server logs for connection issues

Color output not displaying:

  • Ensure force_color = true in ansible.cfg
  • Check terminal/browser color support

Debug Mode

Enable verbose output by adding -vvv to Ansible options for detailed debugging.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

Modern Ansible Management Interface

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages