-
-
Save BretFisher/5be22f2df7b81bee9f38 to your computer and use it in GitHub Desktop.
Test Jinja Not working, just want a list of server IP's
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
The result is a blank file and this error when running: | |
salt 'lb*' state.apply test | |
lb-dev-1: | |
---------- | |
file_|-/opt/local/etc/nginx/upstream.conf_|-/opt/local/etc/nginx/upstream.conf_|-managed: | |
---------- | |
__run_num__: | |
0 | |
changes: | |
---------- | |
comment: | |
Unable to manage file: Jinja variable 'str object' has no attribute 'items' | |
duration: | |
23.038 | |
name: | |
/opt/local/etc/nginx/upstream.conf | |
result: | |
False | |
start_time: | |
18:38:16.946461 |
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
/opt/local/etc/nginx/upstream.conf: | |
file.managed: | |
- source: salt://lb/upstream.conf.jin | |
- template: jinja |
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 server,ip in salt['mine.get']('*', 'network.interfaces', ['eth0']).items() %} | |
server {{ server }} {{ ip }} | |
{% endfor %} |
updated with corrected .jin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I took this jijna example from the docs, but not working: http://docs.saltstack.com/en/latest/topics/reactor/#passing-event-data-to-minions-or-orchestrate-as-pillar