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.0.tar.gz (30.0 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.0-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

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

Hashes for ansible_autoprovisioner-0.3.0.tar.gz
Algorithm Hash digest
SHA256 65807329c99a0d19b1452d1685a14893a2c6c052153e06564830c854eef10742
MD5 0b8193f1079ef9376bb2d9f5d287f5cd
BLAKE2b-256 2b22bca37c8cc87589b39f15271584cdc9e4d3c528132cdf100a6457e4a5d1c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ansible_autoprovisioner-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32ff3cdaa568cb97f8056aa9146806a863c7616553e9cedc157f901f1f44a8ef
MD5 b9e882ab04bf9348942632ef1fc17a2a
BLAKE2b-256 68464745e0a82229dfdaa273cfc9e33fe9d60b0a721a22d13754a4ea66f2fd9f

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