Skip to content

Instantly share code, notes, and snippets.

@hemebond
Created March 27, 2017 11:00
Show Gist options
  • Save hemebond/d5ed255f6658ada4309e6edba4037355 to your computer and use it in GitHub Desktop.
Save hemebond/d5ed255f6658ada4309e6edba4037355 to your computer and use it in GitHub Desktop.
Render a YAML file using the Saltstack Python renderer
#!py
# test.sls
import yaml
def run():
config = {}
map_file = __salt__.cp.cache_file("salt://formula/map.yaml")
try:
with open(map_file, "rb") as f:
map = yaml.safe_load(f.read())
except Exception as e:
print(e)
map = {}
config = __salt__.grains.filter_by(map,
# merge=__salt__.pillar.get('formula:lookup'),
default='default',
base='default')
print(config)
return {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment