New in version 2018.3.0.
This functionality is under development and could be changed in the future releases
Many times it is useful to store the results of a command during the course of an execution. Salt Slots are designed to allow you to store this information and use it later during the highstate or other job execution.
Slots extend the state syntax and allows you to do things right before the state function is executed. So you can make a decision in the last moment right before a state is executed.
Using execution modules return data as a state values is a first step of Slots development. Other functionality is under development.
Slots allow you to use the return from a remote-execution function as an argument value in states.
Slot syntax looks close to the simple python function call.
__slot__:salt:<module>.<function>(<args>, ..., <kwargs...>, ...)
Also there are some specifics in the syntax coming from the execution functions nature and a desire to simplify the user experience. First one is that you don't need to quote the strings passed to the slots functions. The second one is that all arguments handled as strings.
Here is a simple example:
copy-some-file: file.copy: - name: __slot__:salt:test.echo(text=/tmp/some_file) - source: __slot__:salt:test.echo(/etc/hosts)
This will execute the
functions right before calling the state. The functions in the example will
return /tmp/some_file and /etc/hosts strings that will be used as a target
and source arguments in the state function file.copy.