Automatic Ansible provisioning daemon
Project description
Ansible AutoProvisioner
An intelligent automation system that dynamically detects infrastructure changes and automatically executes appropriate Ansible playbooks based on predefined rules.
🎯 What Problem Does This Solve?
Tired of manually running Ansible playbooks when new servers spin up?
This tool automatically:
- 🔍 Detects new infrastructure instances (Static Inventory or AWS)
- 🎯 Matches them against your business rules
- ⚡ Executes appropriate Ansible playbooks immediately
- 📊 Tracks everything automatically with a robust state model
Think of it as "GitHub Actions for your infrastructure" - but triggered by infrastructure changes instead of code commits.
✨ Features
- Automatic Instance Detection: Discovers instances from Ansible inventory files or cloud platforms (AWS).
- Rule-Based Provisioning: Highly flexible rule engine to match instances to playbooks based on host groups, tags, or metadata.
- 5-Status State Model: Clean lifecycle management using
PENDING,RUNNING,SUCCESS,ERROR, andORPHANED. - Prioritized Execution: Guaranteed delivery for new instances (
PENDING) before retrying failed ones (ERROR). - Slack & Telegram Notifications: Real-time alerts for provisioning success or failure.
- Web Dashboard: Modern UI for monitoring activities, viewing logs, and managing retries.
- Concurrent Execution: Provisions multiple instances simultaneously using thread pools for high throughput.
- Comprehensive Logging: Detailed execution logs per instance and per playbook for easy troubleshooting.
🚀 Quick Start
Installation
pip install ansible-autoprovisioner
Basic Configuration
- Create your rules configuration (
rules.yml):
daemon:
interval: 30
max_retries: 3
ui: true
detectors:
static:
inventory: "./inventory.ini"
rules:
- name: "setup-web"
playbook: "./playbooks/nginx.yml"
groups:
web-servers:
match:
role: "webserver"
rules:
- "setup-web"
notifications:
slack:
webhook_url: "https://hooks.slack.com/services/..."
- Run the provisioner:
ansible-autoprovisioner --config rules.yml --ui
📁 Project Structure
ansible_autoprovisioner/
├── detectors/ # Infrastructure discovery system (AWS, Static)
├── notifications/ # Notification handlers (Slack, Telegram)
├── matcher.py # Rule matching engine
├── executor.py # Ansible playbook execution engine
├── state.py # State management and persistence
├── daemon.py # Continuous monitoring loop
├── config.py # Configuration and validation
├── main.py # CLI entry point
└── utils/ # UI Server, API, and Logging utilities
⚙️ How it Works
- Detection: Periodically scans your infrastructure (e.g., AWS tags or inventory files).
- Matching: Compares detected instances against your defined
groupsandrules. - Execution: If an instance needs provisioning, it's marked
PENDINGand queued for a thread-pooled Ansible run. - Tracking: The
state.jsonfile records every step, ensuring playbooks aren't re-run unnecessarily. - Alerting: Once finished, the system notifies you via your chosen channels (Slack/Telegram).
🗺️ Roadmap
🚀 Upcoming Features
- Cloud Platform Detectors: Expanding beyond AWS to Azure and GCP.
- Advanced Matching: Regex support and complex logic (AND/OR/NOT).
- Dependency Tracking: Playbook dependencies and execution ordering.
- Enhanced UI: Visual rule builder and real-time metrics charts.
- Infrastructure Integrations: Terraform post-provision hooks and monitoring integration (Prometheus/Datadog).
📁 Documentation
Detailed documentation is available in the docs/ directory:
- Architecture Documentation - Technical system design
- Configuration Guide - Complete reference for all YAML options
- Usage Examples - Complex patterns and production setups
⚖️ License
MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ansible_autoprovisioner-0.3.0.tar.gz.
File metadata
- Download URL: ansible_autoprovisioner-0.3.0.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65807329c99a0d19b1452d1685a14893a2c6c052153e06564830c854eef10742
|
|
| MD5 |
0b8193f1079ef9376bb2d9f5d287f5cd
|
|
| BLAKE2b-256 |
2b22bca37c8cc87589b39f15271584cdc9e4d3c528132cdf100a6457e4a5d1c5
|
File details
Details for the file ansible_autoprovisioner-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ansible_autoprovisioner-0.3.0-py3-none-any.whl
- Upload date:
- Size: 36.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32ff3cdaa568cb97f8056aa9146806a863c7616553e9cedc157f901f1f44a8ef
|
|
| MD5 |
b9e882ab04bf9348942632ef1fc17a2a
|
|
| BLAKE2b-256 |
68464745e0a82229dfdaa273cfc9e33fe9d60b0a721a22d13754a4ea66f2fd9f
|