コード例 #1
0
ファイル: maas-spaces.py プロジェクト: frobware/jujuWand
def deploy(bootstrap_node_name, bundle_charm):
    if not bootstrapped():
        juju('bootstrap --upload-tools --to "{}"'.format(
              bootstrap_node_name))
    wait()
    juju('deploy ' + bundle_charm)
    wait()
コード例 #2
0
ファイル: openstack.py プロジェクト: dooferlad/jujuWand
def main():
    controller = 'maas'  # bundle specifies series, so leave it unset.
    clean(controller)
    bootstrap(controller, params={'to': 'mal.maas'})
    deploy_bundle('openstack-base', 42)
    wait()
    pprint(status())
コード例 #3
0
ファイル: upload-test.py プロジェクト: dooferlad/jujuWand
def main(controller, series):
    clean(controller)
    bootstrap(controller, params={
        'bootstrap-series': series
    })

    #juju('deploy /home/dooferlad/charms/builds/resource-get-test')
    juju('deploy /home/dooferlad/charms/builds/resource-get-test --resource '
         'aresource=/home/dooferlad/a-file.bin')
    wait()
コード例 #4
0
ファイル: maas-spaces.py プロジェクト: dooferlad/jujuWand
def main():
    vlans = [
        VLAN('internal', '192.168.10.0/24', 10, 'enp2s0.10'),
        VLAN('public', '192.168.11.0/24', 11, 'enp2s0.11'),
        VLAN('db', '192.168.12.0/24', 12, 'enp2s0.12'),
    ]

    bundle_charm = 'charms/mediawiki/bundle.yaml'

    bootstrap_node = maas_setup(vlans, bundle_charm)
    deploy('maas', 'maas', bootstrap_node, bundle_charm)
    wait()
    check(vlans, bundle_charm)
コード例 #5
0
ファイル: add-lxd.py プロジェクト: dooferlad/jujuWand
def main(stop, controller, hosts, guests, wait_between_guests, deploy):
    clean(controller)
    bootstrap(controller)

    wait()
    for i in range(hosts):
        juju('add-machine')
    wait()

    first = True
    for j in range(guests):
        for i in range(hosts):
            if not deploy:
                juju('add-machine lxd:{}'.format(i))

            else:
                # Deploy the Ubuntu charm instead of just adding a machine
                if first:
                    juju('deploy ubuntu --to lxd:{}'.format(i))
                    first = False
                else:
                    juju('add-unit ubuntu --to lxd:{}'.format(i))

        if wait_between_guests:
            wait()

    wait()

    if stop:
        clean(controller)
コード例 #6
0
ファイル: maas-bridge-all.py プロジェクト: dooferlad/jujuWand
def main():
    controllers = ['maas-trusty', 'maas-xenial', 'maas-precise']

    # first kill everything
    for controller in controllers + ['maas']:
        clean(controller)

    # now boot on everything
    for controller in controllers:
        bootstrap(controller, params={'to': 'zoe.maas'})
        # bootstrap(controller, params={'to': 'mal.maas'})
        juju('add-machine')
        wait()
        pprint(status())
        clean(controller)
コード例 #7
0
ファイル: many.py プロジェクト: dooferlad/jujuWand
def main():
    controller = 'maas-xenial'  # bundle specifies series, so leave it unset.
    clean(controller)
    bootstrap(controller, params={'to': 'mal.maas'})

    wait()

    machines = 1
    containers = 2

    if machines > 1:
        juju('add-machine -n {}'.format(machines-1))
    for i in range(machines):
        for j in range(containers):
            juju('add-machine lxc:{}'.format(i))

    wait()
コード例 #8
0
ファイル: lxd-start-stop.py プロジェクト: dooferlad/jujuWand
def main(stop):
    controller = 'lxd'
    clean(controller)
    bootstrap(controller)

    wait()

    juju('add-model foo')
    juju('add-model bar')

    machines = 1
    containers = 2

    for i in range(machines):
        juju('add-machine -m foo')
        juju('add-machine -m bar')
        for j in range(containers):
            juju('add-machine -m foo lxd:{}'.format(i))
            juju('add-machine -m bar lxd:{}'.format(i))

    wait()
    if stop:
        juju('destroy-controller {} --destroy-all-models -y'.format(controller))
        clean(controller)
コード例 #9
0
def main(controller, cloud, series):
    clean(controller)
    bootstrap(controller, cloud, params={
        'bootstrap-series': series,
        'to': 'wash.maas',
    })
    wait()

    # Since this is Juju 2.0 and we can't co-host (well, it isn't preferable)
    # add a machine (i.e. machine 0 in the default model).
    juju('add-machine mal.maas')
    wait()
    juju('add-machine lxd:0')
    wait()
コード例 #10
0
ファイル: maas-spaces.py プロジェクト: dooferlad/jujuWand
def deploy(controller_name, cloud, bootstrap_node_name, bundle_charm):
    bootstrap(controller_name, cloud, bootstrap_node_name)
    
    juju('deploy ' + bundle_charm)
    wait()
コード例 #11
0
ファイル: watch.py プロジェクト: frobware/jujuWand
#!/usr/bin/python

import wand

wand.wait(True)
コード例 #12
0
ファイル: maas-spaces.py プロジェクト: frobware/jujuWand
    services = status()['services']
    for service in services.values():
        for unit in service['units']:
            for relation in service['relations'].keys():
                address = service_address(unit, relation)

                found = False
                for vlan in vlans:
                    if ipaddress.IPv4Address(address) in vlan.network.hosts():
                        print(unit, relation, address, 'in', vlan.name)
                        found = True
                        continue

                if not found:
                    print(unit, relation, address, 'not in a VLAN')


if __name__ == '__main__':
    vlans = [
        VLAN('internal', '192.168.10.0/24', 10, 'enp2s0.10'),
        VLAN('public', '192.168.11.0/24', 11, 'enp2s0.11'),
        VLAN('db', '192.168.12.0/24', 12, 'enp2s0.12'),
    ]

    bundle_charm = 'charms/mediawiki/bundle.yaml'

    #bootstrap_node = maas_setup(vlans, bundle_charm)
    #deploy(bootstrap_node, bundle_charm)
    wait()
    check(vlans)
コード例 #13
0
ファイル: bootstrap.py プロジェクト: dooferlad/jujuWand
def main(controller, cloud, series):
    clean(controller)
    bootstrap(controller, cloud, params={
        'bootstrap-series': series
    })
    wait()