Skip to main content

Elegant deployment with Fabric and Puppet.

Project description

Loom
====

Elegant deployment with [Fabric](http://fabfile.org) and Puppet.

Loom does the stuff Puppet doesn't do well or at all: bootstrapping machines, giving them roles, deploying Puppet code and installing reusable Puppet modules. It's useful for both serverless and master/agent Puppet installations.

Install
-------

$ sudo pip install loom

Getting started
---------------

First of all, you create `fabfile.py` and define your hosts:

from fabric.api import *
from loom import puppet
from loom.tasks import *

env.user = 'root'
env.environment = 'prod'
env.roledefs = {
'app': ['prod-app-1.example.com', 'prod-app-2.example.com'],
'db': ['prod-db-1.example.com'],
}

You can then define any third-party Puppet modules you want in a file called `Puppetfile`:

forge "http://forge.puppetlabs.com"
mod "puppetlabs/nodejs"
mod "puppetlabs/mysql"

(This is for [librarian-puppet](http://librarian-puppet.com/), a tool for installing reusable Puppet modules. It can also install from Git, etc.)

Your own modules are put in a directory called `modules/` in the same directory as `fabfile.py`. Roles are defined in a magic module called `roles` which contains manifests for each role. (If you've used Puppet before, this is a replacement for `node` definitions.)

For example, `modules/roles/manifests/db.pp` defines what the db role is:

class roles::db {
include mysql
# ... etc
}

And that's it!

Let's set up a database server. First, bootstrap the host (in this example, the single db host you defined in `env.roledefs`):

$ fab -R db puppet.install

Then install third party Puppet modules, upload your local modules, and apply them:

$ fab -R db puppet.update puppet.apply

Every time you make a change to your modules, you can run that command to apply them. Because this is just Fabric, you can write a task in `fabfile.py` to do it too:

@task
def deploy_puppet():
execute(puppet.update)
execute(puppet.apply)

Then you could use the included "all" task to update Puppet on all your hosts:

$ fab all deploy_puppet


OS support
----------

It's only been tested on Ubuntu 12.04. I would like to support more things. Send patches!

API
---

Look at the source for now. It's all Fabric tasks, and they're pretty easy to read. (Sorry.)

Contributors
------------
* [Ben Firshman](https://fir.sh)
* [Andreas Jansson](http://andreas.jansson.me.uk/)
* [Steffen L. Norgren](http://github.com/xironix)

Project details


Download files

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

Source Distribution

loom-0.0.6.tar.gz (8.3 kB view details)

Uploaded Source

File details

Details for the file loom-0.0.6.tar.gz.

File metadata

  • Download URL: loom-0.0.6.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for loom-0.0.6.tar.gz
Algorithm Hash digest
SHA256 b70d7911de3182a2434bfe0a5365af94b3c6a25dee021ec82e9e0aa1100aa17e
MD5 f8ddc91b4d7c8f09270deb03c67539a0
BLAKE2b-256 3822ce37418237ebb2515d633db4420359504ed5f20b8ca7e34bfc6d8e4a964c

See more details on using hashes here.

Provenance

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