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)))
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"))
def destroy(state): """Destroy the VMs""" click.echo("Destroying VMs") vmProviders = getHosts(state) for _, vmProvider in vmProviders.items(): vmProvider['cloud'].destroy(vmProvider['hosts'])
def halt(state): """Halt the VMs""" click.echo("Halting VMs") vmProviders = getHosts(state) for _, vmProvider in vmProviders.items(): vmProvider['cloud'].halt(vmProvider['hosts'])
def up(state): """Boot the VMs""" click.echo("Booting VMs") vmProviders = getHosts(state) for _, vmProvider in vmProviders.items(): vmProvider['cloud'].up(vmProvider['hosts'])
def delete(state): """Delete VM snapshots""" click.echo("Deleting VMs snapshots") vmProviders = getHosts(state) for _, vmProvider in vmProviders.items(): vmProvider['cloud'].snapDelete(vmProvider['hosts'])
def restore(state): """Restore VM snapshots""" click.echo("Restoring VMs snapshots") vmProviders = getHosts(state) for _, vmProvider in vmProviders.items(): vmProvider['cloud'].snapRestore(vmProvider['hosts'])
def remove(state): """Remove DNS records""" click.echo("Removing DNS records") vmProviders = getHosts(state) for _, vmProvider in vmProviders.items(): vmProvider['cloud'].dnsremove(vmProvider['hosts'])
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'])