Пример #1
0
def build(state):
    """Build the VMs"""
    start_time = time.time()
    click.echo("Building VMs")
    vmProviders = getHosts(state)
    for _, vmProvider in vmProviders.items():
        vmProvider['cloud'].build(vmProvider['hosts'])
    click.echo("Fixing ssh keys VMs")
    fixKeys(state)
    click.echo("Running bootstrap.yml")
    runPlaybook(state, "bootstrap.yml")
    end_time = time.time()
    click.echo("Time elapsed: {}".format(humanize_time(end_time - start_time)))
Пример #2
0
def summary(state):
    """Display environment summary"""
    vmProviders = getHosts(state)
    data = []
    for _, vmProvider in vmProviders.items():
        for h, v in vmProvider['hosts'].items():
            data.append([
                vmProvider['cloud'].factory, h, vmProvider['cloud'].params(v)
            ])
    click.echo(
        tabulate.tabulate(data,
                          headers=["Provider", "Host", 'Parameters'],
                          tablefmt="psql"))
Пример #3
0
def destroy(state):
    """Destroy the VMs"""
    click.echo("Destroying VMs")
    vmProviders = getHosts(state)
    for _, vmProvider in vmProviders.items():
        vmProvider['cloud'].destroy(vmProvider['hosts'])
Пример #4
0
def halt(state):
    """Halt the VMs"""
    click.echo("Halting VMs")
    vmProviders = getHosts(state)
    for _, vmProvider in vmProviders.items():
        vmProvider['cloud'].halt(vmProvider['hosts'])
Пример #5
0
def up(state):
    """Boot the VMs"""
    click.echo("Booting VMs")
    vmProviders = getHosts(state)
    for _, vmProvider in vmProviders.items():
        vmProvider['cloud'].up(vmProvider['hosts'])
Пример #6
0
def delete(state):
    """Delete VM snapshots"""
    click.echo("Deleting VMs snapshots")
    vmProviders = getHosts(state)
    for _, vmProvider in vmProviders.items():
        vmProvider['cloud'].snapDelete(vmProvider['hosts'])
Пример #7
0
def restore(state):
    """Restore VM snapshots"""
    click.echo("Restoring VMs snapshots")
    vmProviders = getHosts(state)
    for _, vmProvider in vmProviders.items():
        vmProvider['cloud'].snapRestore(vmProvider['hosts'])
Пример #8
0
def remove(state):
    """Remove DNS records"""
    click.echo("Removing DNS records")
    vmProviders = getHosts(state)
    for _, vmProvider in vmProviders.items():
        vmProvider['cloud'].dnsremove(vmProvider['hosts'])
Пример #9
0
def dns_update(state):
    """Update DNS records"""
    click.echo("Updating DNS records")
    vmProviders = getHosts(state)
    for _, vmProvider in vmProviders.items():
        vmProvider['cloud'].dnsupdate(vmProvider['hosts'])