@task
def configure():
    master()
    configurator.launch()

    # run the configurator from the the master server, maximum of 5x
    attempts = 0
    __set_unconfigured_servers()
    while env.unconfigured_servers:
        if attempts != 0:
            local("fab master configurator.restartall")
        if attempts == 5:
            abort("unable to configure the servers")
        attempts += 1
        print(yellow("attempt #{0} for {1}".format(attempts, env.unconfigured_servers)))

        configurator.configure()
        for server in env.unconfigured_servers:
            # if configuration was a success, reboot.
            # for example, a reboot is required when rebuilding a custom kernel
            server = __set_ssh_vars(server)  # mask the server
            if server.port == int(settings.SSH_PORT):
                reboot_server(server.name)
            else:
                print(red("after #{0} attempts, server {1} is still unconfigured".format(
                          attempts, server.name)))
            __set_ssh_vars(env)  # back to default
        __set_unconfigured_servers()

    # last, ensure that SSH is configured (locked down) for each server
    output = local("fab each ssh_test", capture=True)
    if "CONFIGURATOR FAIL!" in output:
        print(red("configurator failure."))
Configure all unconfigured servers.
dataset/ETHPy150Open rizumu/bootmachine/bootmachine/core.py/configure