mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
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:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user