saltstack-System Initialization

Source: Internet
Author: User
Tags add time saltstack

1. Writing resolv.conf (DNS) files

[Email protected] ~]# Cat/srv/salt/system/dns/dns.sls

/etc/resolv.conf:

File.managed:

-Source:salt://system/dns/resolv.conf

-User:root

-Group:root

-mode:644


2. Add time to historical command (history)

[Email protected] ~]# Cat/srv/salt/system/history/history.sls

/etc/profile:

File.append:

-Text:

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


3. Write command audit function

[email protected] ~]# 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] ~]# 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] ~]# Cat/srv/salt/system/init.sls

Include

-System.dns

-System.history

-System.audit

-System.sysctl


6. Execute salt

[[email protected] ~]# Salt ' * ' State.sls system.dns system.history system.audit system.sysctl


7. See if the Minion side is performing successfully

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

Salt-minion:

NameServer 8.8.8.8


This article is from the "Linux" blog, so be sure to keep this source http://syklinux.blog.51cto.com/9631548/1891873

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