-
-
Save anonymous/77d93d99d9a32cc6f19d5263e486929e 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
# on minion | |
root@minion# cat /etc/salt/minion | |
grains: | |
role: qa1 | |
# ... | |
root@minion# salt-call grains.get role | |
local: | |
qa1 | |
root@minion# salt-call state.apply | |
local: | |
Data failed to compile: | |
---------- | |
Pillar failed to render with the following messages: | |
---------- | |
Rendering SLS 'servers.qa' failed. Please see master log for details. | |
root@minion# salt-call saltutil.sync_grains | |
local: | |
root@minion# salt-call state.apply | |
local: | |
Data failed to compile: | |
---------- | |
Pillar failed to render with the following messages: | |
---------- | |
Rendering SLS 'servers.qa' failed. Please see master log for details. | |
# on master | |
root@master# salt -G 'role:qa1' grains.get role | |
i-010...: | |
qa1 |
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
2017-01-06 14:37:22,558 [salt.pillar ][CRITICAL][10803] Rendering SLS 'servers.qa' failed, render error: | |
Jinja error: unsupported operand type(s) for +: 'NoneType' and 'str' | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 379, in render_jinja_tmpl | |
output = template.render(**decoded_context) | |
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render | |
return self.environment.handle_exception(exc_info, True) | |
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception | |
reraise(exc_type, exc_value, tb) | |
File "<template>", line 8, in top-level template code | |
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' | |
; line 8 | |
--- | |
[...] | |
postgres: | |
host: {{ grains.get('role') + 'database.example.com' }} <====================== | |
[...] | |
--- |
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
# pillar/servers/qa.sls | |
postgres: | |
host: {{ grains.get('role') + 'database.example.com' }} |
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
# pillar/top.sls | |
base: | |
# ... | |
'role:qa*': | |
- match: grain | |
- servers.qa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment