View difference between Paste ID: XUpJ8fKH and waK2ECTx
SHOW: | | - or go back to the newest paste.
1
ping.sls:
2
3
{#
4
5
This variable will be buried inside the {{ data }} dictionary. So I expect the following conditional will render to an empty string. Also it's 'post' not 'postdata'. Try {% if data.post.secretkey ... %} instead.
6
7
#}
8
{% if postdata.secretkey == "<secret>" %}
9
10
{#
11
12
The sls data structure in Reactor files is different than regular sls files because it's being run on the master and in a different context. Try this instead:
13
14
pingtest:
15
  cmd.cmd.script:
16
    - tgt: <sometarget>
17
    - kwarg:
18
        user: root
19
        group: root
20
21
#}
22
pingtest:
23
  cmd:
24
   - script
25
   - name: salt://netapi/test.sh
26
   - user: root
27
   - group: root
28
29
{% endif %}
30
31
pingscript.sls
32
33
pingtest:
34
  cmd:
35
   - script
36
   - name: salt://netapi/test.sh
37
   - user: root
38
   - group: root
39
40
Invocation:
41
curl -H "Accept: application/json" -d tgt='base-lj-3' -d secretkey="<secret>" -k https://<ip>:8888/hook/ping