Guest User

Untitled

a guest
Jun 23rd, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.65 KB | None | 0 0
  1. # Say I have a Python function 'token_get' that encapsulates some heavy logic
  2. # and obtains token string required for the particular Pillar file.
  3. # Is it possible to call this function from Jinja template (Variant 1),
  4. # or should I wrap this function into a distinct binary ('token_get_binary')
  5. # and call it like in Variant 2?
  6.  
  7. # Variant 1 (More preferred)
  8. config:
  9.     host: abc.def.com
  10.     port: 8081
  11.     token: {{ token_get(arg1, arg2) }}
  12.  
  13.  
  14. # Variant 2 (Less preffered)
  15. config:
  16.     host: abc.def.com
  17.     port: 8081
  18.     {% set token_get_cmd = ["token_get_binary", arg1, arg2] | join " " %}
  19.     token: {{ salt['cmd.run'](token_get_cmd) }}
Add Comment
Please, Sign In to add comment