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()
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())
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()
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)
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)
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)
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()
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)
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()
def deploy(controller_name, cloud, bootstrap_node_name, bundle_charm): bootstrap(controller_name, cloud, bootstrap_node_name) juju('deploy ' + bundle_charm) wait()
#!/usr/bin/python import wand wand.wait(True)
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)
def main(controller, cloud, series): clean(controller) bootstrap(controller, cloud, params={ 'bootstrap-series': series }) wait()