Server-side Installation Salt-master
Yum Install Salt-master-y
Client Installation Salt-minion
Yum Install Salt-minion-y
Start the service:
Server start Mode:
/etc/init.d/salt-master start
Client startup mode:
/etc/init.d/salt-minion start
Master-side configuration file:
Cat/etc/salt/master | Egrep-v ' ^#|^$ ' Worker_threads:60cachedir:/data1/var/cache/salt/mastertimeout:30open_mode:trueauto_accept: Trueautosign_timeout:0modules:-Cmdrunner_dirs: []file_roots:base:-/srv/salt/dev:-/srv/salt/dev/services -/srv/salt/dev/states prod:-/srv/salt/prod/services-/srv/salt/prod/statespillar_roots:base:-/srv/pil Larlog_level:infolog_level_logfile:info
Minion-side configuration file:
cat/etc/salt/minion | Egrep-v ' ^#|^$ ' Master:10.77.23.34id:10.77.23.24cachedir:/data1/var/cache/salt/minionrandom_reauth_delay:600auth _timeout:160auth_tries:5recon_default:6000recon_max:590000recon_randomize:true
The meaning of each parameter is not much to say, need to know to find out
Test if the communication status between master and Minion is normal:
Salt-key-l | grep ' 10.77.23.24 ' 10.77.23.24salt ' 10.77.23.24 ' test.ping10.77.23.24:true
Master-Side Directory Description:
tree /srv/salt/ # #master base directory/srv/salt/├── dev├── ntp #ntp服务目录 │ ├── conf #ntp服务各种配置文件存放目录 │ │ ├── ntp.conf│ │ ├── ntpd│ │ └── step-tickers│ └── init.sls #ntp服务安装的state文件 └── top.sls # Portal File 3 directories, 5 files
cat top.sls base: ' * ': - ntp.init cat init.sls #Name ntpd installntpd: # #检查ntp是否处于安装状态, if it is not installed, install pkg: - name : ntp - installed service: - running - require: #在启动ntp服务之前必须确保ntp服务已经安装成功 - pkg: ntpd - watch: #监控/etc/ntp.conf file, restart the NTP service if there is a change - file: /etc/ntp.conf/etc/ntp.conf: # #客户端文件路径及名称 file.managed: #文件管理 - source: salt://ntp/conf/ntp.conf ## Synchronize files and paths to the file source on master - user: root #所属用户 - group: root #所属用户组 - mode: 644 #权限设置/etc/ntp/ step-tickers: file.managed: - source: salt://ntp/conf/step-tickers - user: ROOT    - GROUP: ROOT    - MODE: 644/ETC/NTP/NTPD: file.managed: - source: salt://ntp/conf/ntpd - user: root - group: root - mode : 644
After the above is OK, execute the command on the master side:
Salt ' 10.77.23.24 ' state.highstate
You will see the installation process, such as
10.77.23.24:---------- ID: ntpd Function: pkg.installed Name: ntp result: true comment: package ntp is already installed. Started: 16:25:15.084590 Duration: 670.173 ms Changes: ---------- ID: /etc/ntp.conf function: file.managed result: true comment: file /etc/ntp.conf updated started: 16:25:15.759416 Duration: 13.097 ms Changes: ---------- diff: # #这里会显示同步之后和之前的配置文件区别---------- ID: ntpd Function: service.running result: true comment: started service ntpd started: 16:25:15.772810 duration: 127.218 ms Changes: ---------- ntpd: &nbsP True---------- ID: /etc/ntp/step-tickers Function: file.managed Result: True Comment: File /etc/ntp/step-tickers updated started: 16:25:15.900406 duration: 15.072 ms Changes: --------------------          ID: /ETC/NTP/NTPD Function: file.managed Result: True Comment: File /etc/ntp/ntpd updated started: 16:25:15.915669 duration: 11.367 ms changes: ---------- diff: New file mode: 0644summary------------Succeeded: 5 (changed=4) failed: 0------------total states run: 5
This article is from the "Python Random Notes" blog, so be sure to keep this source http://6252961.blog.51cto.com/6242961/1712238
Saltstack installation deployment and NTP service batch deployment process instances