These states allow individual execution module calls to be made via states. To call a single module function use a module.run state:
mine.send:
module.run:
- func: network.interfaces
Note that this example is probably unnecessary to use in practice, since the mine_functions and mine_interval config parameters can be used to schedule updates for the mine (see here for more info).
It is sometimes desirable to trigger a function call after a state is executed, for this the module.wait state can be used:
mine.send:
module.wait:
- func: network.interfaces
- watch:
- file: /etc/network/interfaces
All arguments are passed through to the module function being executed. However, due to how the state system works, if a module function accepts an argument called, name, then m_name must be used to specify that argument, to avoid a collision with the name argument. For example:
disable_nfs:
module.run:
- name: service.disable
- m_name: nfs
Run a single module function
Run a single module function
Run a single module function only if the watch statement calls it
Note
Like the cmd.run state, this state will return True but not actually execute, unless one of the following two things happens:
Current Salt release: 2014.1.6
Docs for previous releases on salt.rtfd.org.