Skip to content

Instantly share code, notes, and snippets.

@gaudenz
gaudenz / cloudscale_inventory.py
Created October 1, 2018 17:25
cloudscale.ch dynamic Ansible inventory prototype
#!/usr/bin/env python
from json import dumps
from os import environ
import sys
import requests
def inventory(servers):
hostvars = dict((server['name'], {'ansible_host': address['address']})
require 'spec_helper'
describe Puppet::Type.type(:vs_port).provider(:ovs) do
before :each do
# Set up stubs for provider checks
# described_class.stubs(:command).with(:vsctl).returns '/usr/bin/ovs-vsctl'
# Set up command stubs, this does not seem to work, or the arguments are wrong?
described_class.stubs(:vsctl).with('get' 'Port' 'eth0', 'interfaces').returns('[cec1ef5a-6281-41d0-8d8a-39610f8f89aa]')
# provider.class.stubs(:vsctl).with([]).returns('')