-
-
Save jalons/4e5853a4009fffc916ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_pillar: | |
- foo | |
- bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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