Allow conditional imports, see examples/playbook3.yml comments for a full explanation. Extensive

refactoring of playbooks now warranted, which we'll do before we move on.   This variable assignment
system makes nearly all possible magic possible, for we can use these variables however we like,
even as module names!
This commit is contained in:
Michael DeHaan 2012-03-19 22:42:31 -04:00
commit 4de7bbb169
15 changed files with 410 additions and 77 deletions

View file

@ -22,6 +22,7 @@ import os
import shlex
import re
import jinja2
import yaml
try:
import json
@ -267,6 +268,12 @@ def template_from_file(path, vars):
''' run a file through the templating engine '''
data = file(path).read()
return template(data, vars)
def parse_yaml(data):
return yaml.load(data)
def parse_yaml_from_file(path):
data = file(path).read()
return parse_yaml(data)