What is the big difference between executable modules and state modules
I am recently researching salt from my doc. However, I am quite confused about the execution of modules and state modules. Why are there two types of modules? Why can't they unite? If we only have one type of module that can be used both on the command line and in the sls file, isn't it easier and better?
source to share
In short:
- Runners: complete the task
- State Module: Try to navigate to a specific state / configuration.
Execution modules:
They are designed to perform tasks on a minion. For example: mysql.query
will query the specified database. The runtime module does not check if the database needs to be queried or not. He's just doing his job.
Take a look at the complete list of modules and you will see that they just do the job for you. https://docs.saltstack.com/en/latest/ref/modules/all/index.html
State module:
It is called a state module.
The state module is also a module. But this is special. With the states module, you can create states (sls files in / srv / salt) for your Minions.
For example, you can create a state that ensures Minion has a web server configured for www.example.com.
Once you've created your state, you can apply it to the state module:
salt <minion> state.apply example_webserver
The status example_webserver
indicates what the Minion should have. If the Minion is already in the correct state, it does nothing. If the Minion is not in the right state, he will try to get there.
The states module can be found here: https://docs.saltstack.com/en/latest/ref/states/all/salt.states.module.html
source to share