fabric-digitalocean is a collection of tools aiming to make it easy to use Fabric and DigitalOcean together.
It was inspired by fabric-aws
pip install fabric-digitalocean
With fabric-digitalocean, you can decorate Fabric tasks to run on a set of DigitalOcean Droplet. The @droplets decorator can take a list of Droplet IDs, a tag, or a region as an argument. If you use a tag or region, it will be expanded to a list of all Droplets with that tag applied or in that region. They can also be used together.
The environmental variable FABRIC_DIGITALOCEAN_TOKEN must contain a DigitalOcean API token.
See below for an example:
fromfabric.apiimporttask, runfromfabric_digitalocean.decoratorsimportdroplets@task@droplets(ids=[8043964, 7997777])deftask_by_ids(): run('hostname') run('uptime') @task@droplets(tag='demo')deftask_by_tag(): run('hostname') run('uptime') @task@droplets(region='nyc3')deftask_by_region(): run('hostname') run('uptime') @task@droplets(region='nyc2', tag='demo')deftask_by_both(): run('hostname') run('uptime')To run the test suite, use:
nosetests -v --with-coverage --cover-package=fabric_digitalocean