Skip to content

Instantly share code, notes, and snippets.

@erchn
Created May 6, 2014 19:55
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 erchn/884dacdc2a5028cd4f75 to your computer and use it in GitHub Desktop.
Save erchn/884dacdc2a5028cd4f75 to your computer and use it in GitHub Desktop.
Sharing state information
# Get logs from other states
{% set mylogs = [] %}
{% for myfile in salt['cp.list_master']() %}
{% if myfile.split('/')[-1] == "log.incl" %}
{% include myfile %}
{% endif %}
{% endfor %}
# {{ mylogs }}
{% if mylogs.append('/var/log/nginx.log') %}
{% endif %}
... snip
# ['/var/log/nginx.log', '/var/log/unicorn.log']
{% if mylogs.append('/var/log/unicorn.log') %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment