Skip to main content

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, and ORPHANED.
  • 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.

Ansible AutoProvisioner UI

🚀 Quick Start

Installation

pip install ansible-autoprovisioner

Basic Configuration

  1. 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/..."
  1. 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

  1. Detection: Periodically scans your infrastructure (e.g., AWS tags or inventory files).
  2. Matching: Compares detected instances against your defined groups and rules.
  3. Execution: If an instance needs provisioning, it's marked PENDING and queued for a thread-pooled Ansible run.
  4. Tracking: The state.json file records every step, ensuring playbooks aren't re-run unnecessarily.
  5. 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:

⚖️ 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

ansible_autoprovisioner-0.3.2.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ansible_autoprovisioner-0.3.2-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

File details

Details for the file ansible_autoprovisioner-0.3.2.tar.gz.

File metadata

  • Download URL: ansible_autoprovisioner-0.3.2.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ansible_autoprovisioner-0.3.2.tar.gz
Algorithm Hash digest
SHA256 ce44c94cb4b4f3f42f2def6ef2de345df1b92a2f02dc9502e97b7c773ac3cfd7
MD5 96a0ac2a714319f357ff62559ba89c35
BLAKE2b-256 2dfd7d5de6592222f13a702c13c277db0599a6aa5f4db32805c1eb24b3566ead

See more details on using hashes here.

File details

Details for the file ansible_autoprovisioner-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ansible_autoprovisioner-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ce9137eee7395cc790a6a0850306fd75e6476db5d08a4d1a5c63753f5b0066f
MD5 042acd98e9aa70d4bf820dd0874dc94a
BLAKE2b-256 a182badfa2990555432cd4efbe35ce60570fc55204629834285d813bc802ab7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page