So far as I can see in the Salt documentation (e.g. here) there are two main types of modules supported: state modules and execution modules (I know there're also renderers, returners and so on). Most of examples of SLS files contain statements related only to state modules (under salt.state namespace) whereas for execution modules only command line examples are shown. For example we have two modules named "service": salt.states.service and salt.modules.service. Right now I have problems using execution modules in SLS files and it seems that either they're not available at all or I'm missing something to make them available. My question is: is it possible to use execution modules in SLS files and how for example can I restart a service on Ubuntu machine using salt.modules.service.restart function? Also I don't clearly get the difference between these modules types.
My service name is selenium-node and I tried several combinations and all of them failed:
# First attempt:
selenium-node:
service.restart
# Another one:
service:
- restart
- name: selenium-node
# Or even:
selenium-node:
service:
- restart
I faced the same issue when working with git state and execution modules. However when I run the following command on the minion (as shown in the documentation) it succeeds:
$ sudo salt-call service.restart selenium-node