Skip to content

Instantly share code, notes, and snippets.

@Slimmons
Last active July 19, 2016 21:20
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 Slimmons/b52d768f52033c86890666759d4836e0 to your computer and use it in GitHub Desktop.
Save Slimmons/b52d768f52033c86890666759d4836e0 to your computer and use it in GitHub Desktop.
#This file is located at /srv/reactor/testdirectory/configure.sls
{% set postdata = data.get('post', {}) %}
{% if grains['os_family']=="Debian" %}
testifthisworks:
local.state.apply:
- tgt: {{ postdata.tgt }}
- arg:
- transferfile.init
{% endif %}
#This file is located at /srv/salt/transferfile/init.sls
/root/testfile.txt:
file.managed:
- source: salt://testfiles/testfile.txt
- makedirs: True
- mode: 700
- template: jinja
#This file is located at /etc/salt/master.d/reactor.conf
reactor:
- 'salt/netapi/hook/test':
- /srv/reactor/testdirectory/configure.sls
@whytewolf
Copy link

testifthisworks:
  local.state.apply:
    - tgt: {{ postdata.tgt }}
    - arg:
      - transferfile.init

@Slimmons
Copy link
Author

So, as it stands right now I get the postdata in the configure.sls file, but I'd like to be able to pass in more postdata, and use it in the init.sls, or other places. Is there a way to pull all of the postdata (data.get) and put it in the pillar or grains? Or possibly pass it into init.sls?

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