"Salt's directory Structure"
The environment has a default, but you can change the configuration in the/etc/salt/master file file_roots
File_roots:
Base
-/data1/salt/base/
Db:
-/data1/salt/db/
Dev
-/data1/salt/dev/
Prod
-/data1/salt/prod/
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/82/7D/wKioL1dWxk6RXYN4AABVqeZqhCQ679.jpg "title=" Saltstack directory structure. jpg "alt=" wkiol1dwxk6rxyn4aabvqezqhcq679.jpg "/>
"Mastering Saltstack's SLS file namespace issues first"
Follow these rules:
SLS is a name extension
. SLS is omitted (e.g. Zabbix.sls when used as Zabbix)
When the package is present, such as: Execute Package 1/xxx.sls, in the form of package 1.xxx
If the package directory creates a Init.sls file, the reference only specifies that directory (for example, package 1/init.sls can be abbreviated as Package 1)
If both the package 1.sls and package 1/init.sls are present in a directory, the package 1/INIT.SLS will be ignored, and the SLS file reference package 1 will only reference package 1.sls
"From the following two execution methods, you can understand the above said."
Salt "dev-mysql001" State.highstate-v test=true
Highstate means to start execution from Top.sls in the base environment (default is the execution base environment) directory
So your top.sls could be written like this.
Base
‘*‘:
-Init # The SYSTEM init
-Users # Add users three user one PubKey
-Sudoer # config Sudoer
-Yum # repos config file
-Hosts # Sync host and resolve
-SSH # ssh-client,ssh-server config
-NTPD # Service NTPD
-Syslog # Log server config
-Monitor # zabbix,salt-minion Config
-Vim # Vim,vimconfig Vimcolor
Salt ' dev-mysql001 ' State.sls monitor-v test=true
State.sls means to execute a specified. sls file. Monitor has the 4th rule of the SLS naming convention, execute the INIT.SLS under package 1
Maybe the SLS file under the monitor package is written like this.
# Cat Monitor/init.sls
Include
-. Zabbix
# Cat Monitor/zabbix.sls
Zabbix-agent:
Pkg
-Installed
-Names:
-Zabbix-agent
"About the rest, you know what time it is."
1 know how to-v test=true to verify (cmd.rum Execute command This is useless oh remember oh don't be silly)
2 Salt "dev-mysql001" cmd.run "You Command"
3 Slat "dev-mysql001" test.ping
4 know how to tail-f/var/log/salt/minion view (master performs a log build in Minion)
5 know how to adjust the Minion configuration file in Log_level = Debug This adjustment is useful when troubleshooting (default is #log_level:warning)
6 Observe the green yellow red in the execution result what does it mean ~~
"about how to write. sls files, if you understand one, Baidu Baidu will know how to write"
This article is from the "Tridewah operation and maintenance work Road" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1787112
Saltstack know this is good.