This is a project to develop an ansible dynamic inventory plugin backed by MongoDB. The inventory can be managed using REST calls, implemented using FlaskRestPlus. The inventory plugin must receive an inventory name, get the respective inventory via API and parse it to create the in-memory inventory. Hosts and groups can be manipulated individually via API, or the hole inventory can be edited in .ini format.
pip3 install -r requirements.txt
docker-compose up -d
python3 wsgi.py
Access http://localhost:5000
ansible_plugin/ - ansible inventory plugins examples
app/auth/
app/common/
app/inventory
app/users
app/utils/
inventory_files - inventory examples
scripts - script examples
See app/inventory/inventory.json
-
api/v1/auth - OK
-
api/v1/users - OK
-
api/v1/inventory
- create inventory - OK
- get inventories - OK
- archive inventory - OK
- reactivate inventory - OK
- delete inventory - OK
-
api/v1/hosts
- include host - OK (*to do: create missing groups)
- edit host - OK
- delete host - OK
- get host
-
api/v1/groups
- include group - OK
- edit group - OK
- delete group - OK
- get group
-
ini_to_json.py
-
json_to_ini.py
-
ansible inventory plugin
- get all_vars
- get groups
- get group_vars
- get host_vars
- add_host