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