Skip to content

Instantly share code, notes, and snippets.

Created June 3, 2016 18:47
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 anonymous/0d1114bcb73105e3a5ecb11a6ec9ac7c to your computer and use it in GitHub Desktop.
Save anonymous/0d1114bcb73105e3a5ecb11a6ec9ac7c to your computer and use it in GitHub Desktop.
salt/beacon/NOPE/service/ {
"_stamp": "2016-06-03T18:46:33.514524",
"data": {
"RasMan": {
"running": true
},
"id": "NOPE"
},
"tag": "salt/beacon/NOPE/service/"
@jfindlay
Copy link

jfindlay commented Jun 3, 2016

Again, it seems like kind of a hack, but this should work:

{%- for item in data['data']: %}
  {%- if item != 'id': %}
    {%- set service = item %}
  {%- endif %}
{%- endfor %}
{# or #}
{%- set service = [item for item in data['data'] if item != 'id'][0] %}

{% if data['data'][service]['running'] == false %}
 These_things:
   local.state.apply:
     - tgt: {{data['data']['id']}}
{% endif %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment