mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41:23 -07: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:
parent
5ed2b894d9
commit
4de7bbb169
15 changed files with 410 additions and 77 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue