Using reboot operation

The syntax for the Fabric reboot operation is as follows:

reboot(wait=120)

This is a simple operation that reboots the host by default. Fabric will wait for 120 seconds before attempting to reconnect, but you can change this value to another one by using the wait argument:

def reboot_ops():    reboot(wait=60, use_sudo=True)

For a full list of other supported operations, please check http://docs.fabfile.org/en/1.14/api/core/operations.html. You can also check them directly from PyCharm, by looking at all of the autocomplete functions that pop up when you type Ctrl + spacebar. From fabric.operations import <ctrl+space> under fabric.operations:

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.