First, simple test
In the previous 3 subsections we introduced Saltstack and explained the installation deployment of salt. Believe that you now have only one master and at least one minion. Can we do something about it? The following two chapters lead readers to quickly use Saltstack's remote execution and configuration management functions.
One of the core functions of saltstack at remote execution time. The main use of the Salt module can be batch to the selected Minion side to execute the corresponding command, and get the results returned. Let's execute the first salt command.
[[Email protected] ~] # Salt ' * ' test.pingsalt-client: True
The above command is used to see which Minion nodes are connected to master. * refers to the selected target Minion, which is clearly representative of all. Is all the Minion end. Test.ping is a module that salt remotely executes. (Note: This is not an ICMP ping.) )
Saltstack can use the Cmd.run module to execute shell commands remotely, using Cmd.run. For example, let the Minion node run the date command.
[[Email protected] ~] # Salt ' * ' cmd.run ' date ' salt-client: 04:45:46 CST 2016
Saltstack provides a large number of command modules that can be used. For more detailed remote implementation of the relevant knowledge, please refer to Chapter Nineth. Well, maybe you don't want to have more orders, so enjoy your cmd.run. However, because Cmd.run can execute all the commands, it is not recommended to use Cmd.run in a production environment. Or use ACLs to control which users are allowed to use Cmd.run.
Saltstack (iii) remote execution