Skip to content

Instantly share code, notes, and snippets.

@jalons

jalons/Result Secret

Created October 29, 2014 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalons/4e5853a4009fffc916ab to your computer and use it in GitHub Desktop.
Save jalons/4e5853a4009fffc916ab to your computer and use it in GitHub Desktop.
my_pillar:
- foo
- bar
{% for value in salt['pillar.get']('my_pillar') %}
/tmp/{{value}}.file:
file.managed:
- name: /tmp/{{ value }}.file
- source: salt://pillar_toy/template.file
- template: jinja
- pillar:
my_server_type: {{ value }}
{% endfor %}
[root@MASTER pillar_toy]$ salt MINION\* state.sls pillar_toy env=Staging
MINION:
----------
State: - file
Name: /tmp/foo.file
Function: managed
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/state.py", line 1315, in call
*cdata['args'], **cdata['kwargs'])
File "/usr/lib/python2.6/site-packages/salt/states/file.py", line 1139, in managed
**kwargs
File "/usr/lib/python2.6/site-packages/salt/modules/file.py", line 1603, in get_managed
**kwargs)
TypeError: render_tmpl() got multiple values for keyword argument 'pillar'
Changes:
----------
State: - file
Name: /tmp/bar.file
Function: managed
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/state.py", line 1315, in call
*cdata['args'], **cdata['kwargs'])
File "/usr/lib/python2.6/site-packages/salt/states/file.py", line 1139, in managed
**kwargs
File "/usr/lib/python2.6/site-packages/salt/modules/file.py", line 1603, in get_managed
**kwargs)
TypeError: render_tmpl() got multiple values for keyword argument 'pillar'
Changes:
Summary
------------
Succeeded: 0
Failed: 2
------------
Total: 2
my pillar is {{ salt['pillar.get']('my_server_type') }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment