(vi) Saltstack Project actual Combat _ system initialization

Source: Internet
Author: User

First, System initialization

1. Writing resolv.conf (DNS) files


[Email protected] init]# Cat/etc/salt/states/init/dns.sls

/etc/resolv.conf:

File.managed:

-Source:salt://init/files/resolv.conf

-User:root

-Group:root

-mode:644

2. Add time to Historical order (history)


[Email protected] init]# Cat/etc/salt/states/init/history.sls

/etc/profile:

File.append:

-Text:

-Export histtimeformat= "%F%T ' WhoAmI '"

3. Write command audit function


[email protected] init]# cat Audit.sls

/etc/bashrc

File.append:

-Text:

-Export prompt_command= ' {msg=$ (History 1 | {read x y; echo $y;}); Logger "[euid=$ (WhoAmI)]": $ (Who am I): [' pwd '] "$msg"; }‘

4. Changing kernel parameters


[email protected] init]# cat Sysctl.sls

Vm.swappiness:

Sysctl.present:

-value:0

Net.ipv4.ip_local_port_range:

Sysctl.present:

-value:10000 65000

Fs.file-max:

Sysctl.present:

-value:100000

5. Centralized management of the above 4 configuration files


[email protected] init]# cat Env_init.sls

Include

-Init.dns

-Init.history

-Init.audit

-Init.sysctl

6. Writing the Top.sls file


[Email protected] init]# CD.

[email protected] states]# cat Top.sls

Base

‘*‘:

-Init.env_init

7. Execute salt


[[email protected] states]# Salt ' * ' state.highstate test=true #模拟运行 (Build environment Run method)




8. See if the Minion side is performing successfully


[[email protected] init]# Salt ' * ' state.highstate

[[email protected] init]# Salt ' * ' cmd.run ' cat/etc/resolv.conf '

Node2.bier.com:

; Generated By/sbin/dhclient-script

Search Localdomain

NameServer 114.114.114.114

Node3.bier.com:

; Generated By/sbin/dhclient-script

Search Localdomain

NameServer 114.114.114.114







This article is from the "Bill Linux Operations Notes" blog, please be sure to keep this source http://chenshoubiao.blog.51cto.com/6159058/1884490

(vi) Saltstack Project actual Combat _ system initialization

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.