@task
def reboot_server(name):
    __shared_setup()
    try:
        server = [s for s in env.bootmachine_servers if s.name == name][0]
    except IndexError:
        abort("The server '{0}' was not found.".format(name))
    original_user = env.user
    original_host_string = env.host_string
    try:
        env.port = 22
        telnetlib.Telnet(server.public_ip, env.port)
        env.user = "root"
    except IOError:
        env.port = int(settings.SSH_PORT)
        env.user = getpass.getuser()
        telnetlib.Telnet(server.public_ip, env.port)
    env.host_string = "{0}:{1}".format(server.public_ip, env.port)

    env.keepalive = 30  # keep the ssh key active, see fabric issue #402
    with fabric_settings(warn_only=True):
        reboot()

    env.user = original_user
    env.host_string = original_host_string
Simply reboot a server by name.
dataset/ETHPy150Open rizumu/bootmachine/bootmachine/core.py/reboot_server