如果环境复杂,一定需要在使用的时候指定环境,默认环境为base salt 'minion1' state.sls saltenv="base" example
minion1: ----------(自带的注释) ID: nginx Function: pkg.installed Result: True Comment: The following packages were installed/updated: nginx Started: 14:05:08.049181 Duration: 9614.023 ms Summary for minion1 ------------ Succeeded: 2 (changed=2) Failed: 0 ------------ Total states run: 2 Total run time: 9.717 s
查询某一个状态模块的方法的用法 salt 'minion1' sys.state_doc file.absent file.absent: Make sure that the named file or directory is absent. If it exists, it will be deleted. This will work to reverse any of the functionsin the file state module. If a directory is supplied, it will be recursively deleted. If only the contents of the directory need to be deleted but not the directory itself, use :mod:`file.directory <salt.states.file.directory>` with ``clean=True`` name The path which should be deleted