infodot-be / django-ansible-inventory

A Django application that can be used as dynamic Ansible inventory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django-ansible-inventory

Build Status

This django project will create an REST API server for dynamic inventory for Ansible. The Ansible inventory can dynamically query this REST API during playbook execution.

The object Manipulation is done via REST API directly or the ipam-cli interface.

All objects are case sensitive in the current version.

The inventory.py script available in the scripts directory will retrieve the information and format it for Ansible

[]$ ansible-inventory -i inventory.py --list
{
    "Master": {
        "hosts": [
            "obiwan.example.com",
            "yoda.example.com"
        ]
    },
    "Padawan": {
        "hosts": [
            "anakin.example.com",
            "luke.example.com"
        ]
    },
    "_meta": {
        "hostvars": {
            "anakin.example.com": {},
            "luke.example.com": {},
            "obiwan.example.com": {},
            "yoda.example.com": {}
        }
    },
    "all": {
        "children": [
            "Master",
            "Padawan",
            "ungrouped"
        ]
    }
}

About

A Django application that can be used as dynamic Ansible inventory

License:MIT License


Languages

Language:Python 98.1%Language:Shell 0.9%Language:Dockerfile 0.5%Language:HTML 0.4%