Hemp
Environment aware configuration and tools for Fabric.
Installation
pip install hemp
What is Hemp
Usage
fab
with hemp
should work out of the
box.Differences from Fabric
Fabfile location
fabfile.py
from current working
directory or any of the parent directories.fabfile.py
located in
$HOME
of the current user.Hemp files
hemp.yml
. They are loaded, by default, from $HOME
hemp.yml
if found both at home directory of the user and
current working directory, both files are loaded andhemp.yml
located in current working directory taking precedence.Default stages
on
task.Consider these samples:
hemp development [task]
hemp on:development [task]
will ultimately result in development
stage to be used.
Sample environment configuration
hemp:
environments:
staging:
roles:
web: ['web0.host.com']
db: ['web0.host.com']
production:
roles:
web: ['web1.host.com', 'web2.host.com', 'web3.host.com', 'web4.host.com']
db: ['web1.host.com']
development:
roles:
web: ['web5.host.lan']
db: ['web5.host.lan']
# [...]
Loading the hosts and roledefs
on
task, Hemp will
load appropriate configs to Fabric’s env
dictionary.staging
stage will populate env
with
fallowing values:env.hosts = ['web0.host.com']
env.roledefs['web'] = ['web0.host.com']
env.roledefs['db'] = ['web0.host.com']
Host and role definition merging
env
dictionary, both for hosts
env
settings
Additional All root keys of the hemp.yml
file will be loaded into Fabric’s
env
dictionary. For example, having configuration like
hosts: ['a.com', 'b.com']
hemp: [
# ...
]
will result in env.hosts
to be populated with a.com
and
b.com
License
Licensed under terms and conditions of Apache 2.0 license.