Skip to content

Instantly share code, notes, and snippets.

View wallnerryan's full-sized avatar

Ryan Wallner wallnerryan

  • Boston, MA
  • 00:06 (UTC -04:00)
View GitHub Profile
[global]
donothing=true
@wallnerryan
wallnerryan / inventory2json.py
Created December 11, 2019 17:07 — forked from sivel/inventory2json.py
Ansible inventory to dynamic inventory JSON output, accepts all inventory input formats
import sys
import json
from ansible.parsing.dataloader import DataLoader
try:
from ansible.inventory.manager import InventoryManager
A24 = True
except ImportError:
from ansible.vars import VariableManager
packageportworximport("fmt""os"volumeclient"github.com/libopenstorage/openstorage/api/client/volume""k8s.io/klog""k8s.io/utils/mount"utilstrings"k8s.io/utils/strings"v1"k8s.io/api/core/v1""k8s.io/apimachinery/pkg/api/resource"metav1"k8s.io/apimachinery/pkg/apis/meta/v1""k8s.io/apimachinery/pkg/types""k8s.io/kubernetes/pkg/volume""k8s.io/kubernetes/pkg/volume/util")const(attachContextKey="context"attachHostKey="host")//ProbeVolumePluginsistheprimaryentrypointforvolumeplugins.funcProbeVolumePlugins()[]volume.VolumePlugin{return[]volume.VolumePlugin{&portworxVolumePlugin{nil,nil}}}typeportworxVolumePluginstruct{hostvolume.VolumeHostutil*portworxVolumeUtil}var_volume.VolumePlugin=&portworxVolumePlugin{}var_volume.PersistentVolumePlugin=&portworxVolumePlugin{}var_volume.DeletableVolumePlugin=&portworxVolumePlugin{}var_volume.ProvisionableVolumePlugin=&portworxVolumePlugin{}var_volume.ExpandableVolumePlugin=&portworxVolumePlugin{}const(portworxVolumePluginName="kubernetes.io/portworx-volume")funcgetPath(uidtypes.UI