Skip to main content

Tools for writing awesome Fabric files

Project description

About

fabtools includes useful functions to help you write your Fabric files.

fabtools makes it easier to manage system users, packages, databases, etc.

fabtools includes a number of low-level actions, as well as a higher level interface called fabtools.require.

Using fabtools.require allows you to use a more declarative style, similar to Chef or Puppet.

Installing

To install the latest release from PyPI

$ pip install fabtools

To install the latest development version from GitHub

$ pip install git+git://github.com/ronnix/fabtools.git

Example

Here is an example fabfile.py using fabtools

from fabric.api import *
from fabtools import require
import fabtools

@task
def setup():

    # Require some Debian/Ubuntu packages
    require.deb.packages([
        'imagemagick',
        'libxml2-dev',
    ])

    # Require a Python package
    with fabtools.python.virtualenv('/home/myuser/env'):
        require.python.package('pyramid')

    # Require an email server
    require.postfix.server('example.com')

    # Require a PostgreSQL server
    require.postgres.server()
    require.postgres.user('myuser', 's3cr3tp4ssw0rd')
    require.postgres.database('myappsdb', 'myuser')

    # Require a supervisor process for our app
    require.supervisor.process('myapp',
        command='/home/myuser/env/bin/gunicorn_paster /home/myuser/env/myapp/production.ini',
        directory='/home/myuser/env/myapp',
        user='myuser'
        )

    # Require an nginx server proxying to our app
    require.nginx.proxied_site('example.com',
        docroot='/home/myuser/env/myapp/myapp/public',
        proxy_url='http://127.0.0.1:8888'
        )

    # Setup a daily cron task
    fabtools.cron.add_daily('maintenance', 'myuser', 'my_script.py')

Supported targets

fabtools currently supports the following target operating systems:

  • Debian 6.0 (squeeze)

  • Ubuntu 10.04 (lucid)

  • Ubuntu 12.04 (precise)

  • RHEL 5/6

  • CentOS 5/6

  • Scientific Linux 5/6

  • SmartOS (Joyent)

  • Archlinux

Contributions to help support other Unix/Linux distributions are welcome!

Automatic integration test result

https://api.travis-ci.org/ronnix/fabtools.png

Changelog

Version 0.15.0 (2013-07-25)

  • Fix missing import in user.local_home_directory() (Sebastien Beal)

  • Improved Arch Linux support:
    • Fix locale support in Arch Linux (Bruno Adele)

    • Add support for yaourt package manager in Arch Linux (Bruno Adele)

  • Improvements to the redis module:
    • Fix Redis startup after reboot (Victor Perron)

    • Upgrade default Redis version to 2.6.14

  • Improvements to the git module:
    • Add optional force parameter to git pull and checkout (Sebastien Beal)

  • Improvements to the python module:
    • Add parameter to use a specific Python interpreter (Bruno Adele)

    • Stop using PyPI mirrors now that it has a CDN (Dominique Lederer)

  • Debian/Ubuntu improvements:
    • Add optional version parameter to deb.install() (Anthony Scalisi)

    • Improved support for installing APT public keys (Santiago Mola)

  • SmartOS improvements (Andreas Kaiser):
    • Fix md5sum on recent SmartOS

    • Fix bug in pkg.is_installed with certain package names

    • Add support for SmartOS in remote system identification

    • Add support for SmartOS in require.git.command()

  • RedHat improvements:
    • Fix broken rpm.install() (Sho Shimauchi)

  • Oracle JDK improvements:
    • Upgrade default version to 7u25-b15 (Sebastien Beal)

    • Fix Oracle JDK version parsing when OpenJDK is installed

    • Fix Oracle JDK installation on Debian squeeze (Stéphane Klein)

  • Better tests documentation (thanks to Stéphane Klein)

  • Add require.directories() (Edouard de Labareyre)

  • Add support for Apache web server (Stéphane Klein)

  • Upgrade default Node.js version to 0.10.13

Version 0.14.0 (2013-05-22)

Note: Fabtools now requires Fabric >= 1.6.0

  • Upgrade default pip version to 1.3.1

  • Improved vagrant support:
    • Add support for Vagrant 1.1 providers in functional tests

    • Also set env.user and env.hosts in vagrant context manager

  • Add fabtools.system.cpus to get the host’s CPU count

  • Less verbose output

  • Move OS detection functions to fabtools.system

  • Better support for Red Hat based systems

  • Improvements to the user module:
    • Fix home dir default behaviour in require.user

    • Add support for SSH authorized keys (Kamil Chmielewski)

    • Add support for SSH known hosts public keys

    • Add non_unique argument to user functions (Zhang Erning)

    • Get absolute path to the local user’s home dir (Sebastien Beal)

  • Use SHOW DATABASES to test existence of MySQL (Zhang Erning)

  • Improvements to the git module
    • Expose lower level fetch operation (Andreas Kaiser)

    • Fix missing import in require module (Muraoka Yusuke)

    • Require git command line tool

  • Use ifconfig as root in network module

  • Update OpenVZ guest context manager for Fabric 1.6.0

  • Improvements to the python module:
    • Improved detection of distribute

    • Add support for virtualenv --prompt option (Artem Nezvigin)

    • Allow relative path in virtualenv context manager

  • Improvements to the oracle_jdk module:
    • Upgrade default Oracle JDK version to 7u21-b11 (Kamil Chmielewski)

    • Add support for Oracle JDK version 6 (Sebastien Beal)

  • Fix broken fabtools.deb.upgrade

  • Add support for Arch Linux packages (Bruno Adele)

  • Add support for Linux disk partitions (Bruno Adele)

  • Add OpenSSH server hardening (Adam Patterson)

  • Add systemd module (Jakub Stasiak)

  • Improvements to the redis module:
    • Fix broken Redis configuration (Victor Perron)

    • Upgrade default Redis version to 2.6.13

  • Abort on nginx configuration errors

  • Upgrade default Node.js version to 0.10.7

Version 0.13.0 (2013-03-15)

  • Add support for managing remote git repositories (Andreas Kaiser)

  • Add intersphinx to docs (Andreas Kaiser)

  • Add HTTP proxy support to speed up functional tests

  • Upgrade default Node.js version to 0.10.0

  • Upgrade default Redis version to 2.6.11

  • Upgrade default Oracle JDK version to 7u17-b02

  • Fix vagrant support (thanks to Dominique Lederer and anentropic)

Version 0.12.0 (2013-03-04)

  • Do not create home directory for system users

  • Fix pkg.is_installed on SmartOS (thanks to Anthony Scalisi)

  • Fix system.get_arch (thanks to Kamil Chmielewski)

  • Add support for installing Oracle JDK (thanks to Kamil Chmielewski)

  • Add support for creating Postgres schemas (thanks to Michael Bommarito)

  • Fix mysql.user_exists (thanks to Serge Travin)

Version 0.11.0 (2013-02-15)

  • Fix requiring an existing user (thanks to Jonathan Peel)

  • Upgrade default Redis version to 2.6.10

  • Upgrade default Node.js version to 0.8.19

  • Better support for remote hosts where sudo is not installed

Version 0.10.0 (2013-02-12)

  • Enable/disable nginx sites (thanks to Sébastien Béal)

  • Add support for SmartOS (thanks to Anthony Scalisi)

  • Add support for RHEL/CentOS/SL (thanks to Anthony Scalisi)

Version 0.9.4 (2013-01-10)

  • Add files missing in 0.9.3 (thanks to Stéfane Fermigier)

Version 0.9.3 (2013-01-08)

  • Fix bugs in user creation (thanks pahaz and Stéphane Klein)

  • Add support for group creation

Version 0.9.2 (2013-01-05)

  • Add syntax highlighting in README (thanks to Artur Dryomov)

Version 0.9.1 (2013-01-04)

  • Fix documentation formatting issues

Version 0.9.0 (2013-01-04)

  • Improve user creation and modification

  • Add support for BSD / OS X to files.owner, files.group, files.mode and files.md5sum (thanks to Troy J. Farrell)

  • Improve PostgreSQL user creation (thanks to Troy J. Farrell and Axel Haustant)

  • Add reload and force_reload operations to the service module (thanks to Axel Haustant)

  • Fix missing import in require.redis (thanks to svevang and Sébastien Béal)

  • Add clear option to Python virtualenv (thanks to pahaz)

  • Upgrade default Redis version to 2.6.7

  • Upgrade default Node.js version to 0.8.16

  • Decrease verbosity of some operations

  • Speed up functional tests

Version 0.8.1 (2012-10-26)

  • Really fix pip version parsing issue

  • Upgrade default pip version to 1.2.1

Version 0.8.0 (2012-10-26)

  • Improve user module (thanks to Gaël Pasgrimaud)

  • Fix locale support on Debian (thanks to Olivier Kautz)

  • Fix version number in documentation (thanks to Guillaume Ayoub)

  • Fix potential issue with pip version parsing

Version 0.7.0 (2012-10-13)

  • Fix changed directory owner requirement (thanks to Troy J. Farrell)

  • Add functions to get a file’s owner, group and mode

Version 0.6.0 (2012-10-13)

  • Add support for Node.js (thanks to Frank Rousseau)

  • Fix dependency on Fabric >= 1.4.0 (thanks to Laurent Bachelier)

Version 0.5.1 (2012-09-21)

  • Documentation and packaging fixes

Version 0.5 (2012-09-21)

  • The watch context manager now allows you to either provide a callback or do an explicit check afterwards (warning: this change is not backwards compatible, please update your fabfiles)

  • Add support for some network-related operations:
    • get the IPV4 address assigned to an interface

    • get the list of name server IP addresses

  • The services module now supports both upstart and traditional SysV-style /etc/init.d scripts (thanks to Selwin Ong)

  • The virtualenv context manager can now also be used with local() (thanks to khorn)

  • The supervisor module now uses update instead of reload to avoid unnecessary restarts (thanks to Dan Fairs)

  • Add support for OpenVZ containers (requires a kernel with OpenVZ patches)

  • pip can now use a download cache

  • Upgrade Redis version to 2.4.17

  • Misc bug fixes and improvements

  • Support for Ubuntu 12.04 LTS and Debian 6.0

  • Documentation improvements

Version 0.4 (2012-05-30)

  • Added support for requiring an arbitrary APT source

  • Added support for adding APT signing keys

  • Added support for requiring a user with a home directory

  • Added vagrant helpers

  • Fixed Python virtualenv context manager

Version 0.3.2 (2012-03-19)

  • Fixed README formatting

Version 0.3.1 (2012-03-19)

  • Fixed bug in functional tests runner

Version 0.3 (2012-03-19)

  • Added support for Shorewall (Shoreline Firewall)

  • Fixed Python 2.5 compatibility

  • Refactored tests

Version 0.2.1 (2012-03-09)

  • Packaging fixes

Version 0.2 (2012-03-09)

  • Added support for hostname and sysctl (kernel parameters)

  • Added support for Redis

  • Simplified API for supervisor processes

Version 0.1.1 (2012-02-19)

  • Packaging fixes

Version 0.1 (2012-02-19)

  • Initial release

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fabtools-0.15.0.tar.gz (68.1 kB view details)

Uploaded Source

File details

Details for the file fabtools-0.15.0.tar.gz.

File metadata

  • Download URL: fabtools-0.15.0.tar.gz
  • Upload date:
  • Size: 68.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fabtools-0.15.0.tar.gz
Algorithm Hash digest
SHA256 b552e71765176cbc49b553725b193a27d9a68c5ca5f7533116439874fe9cac24
MD5 346ad662ebe0ab89fdd7d8805148c528
BLAKE2b-256 d5c01fb10c785e44d2ab88e0575adae7681c73d65fb998dc8407a4b3c7d5a995

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page