#!/usr/bin/env python

import json
import urllib2


librenms = json.loads(
    urllib2.urlopen(urllib2.Request(
        'https://librenms.hamwan.org/api/v0/devices',
        headers={'X-Auth-Token': '600dc6857a6e2bf200b46e56b78c0049'},
    )).read()
)

inventory = {
    "_meta": {
        "hostvars": {}
    }
}

for key in ('os', 'sysName', 'type', 'version'):
    for device in librenms['devices']:
        group = device.get(key)
        if not group:
            continue
        if not inventory.get(group):
            inventory[group] = []
        inventory[group].append(device['hostname'])

# converts the 'status' field to an 'available' list
inventory['available'] = [device['hostname'] for device in librenms['devices']
                          if int(device.get('status'))]

print json.dumps(inventory, indent=2)

@@ -303,16 +303,155 @@
 %7B%7D%0A    %7D
+,%0A    %22all%22: %5Bdevice%5B'hostname'%5D for device in librenms%5B'devices'%5D%5D,%0A    %22seattle%22: %5Bdevice%5B'hostname'%5D for device in librenms%5B'devices'%5D%5D,
 %0A%7D%0A%0Afor 

Add seattle group to LibreNMS dynamic inventory to trigger seattle group vars.