Saltstack know this is good.

Source: Internet
Author: User

"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:

    1. SLS is a name extension

    2. . SLS is omitted (e.g. Zabbix.sls when used as Zabbix)

    3. When the package is present, such as: Execute Package 1/xxx.sls, in the form of package 1.xxx

    4. 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)

    5. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.