Installation Script install_salt.sh:
#!/bin/bash
# # #安装第三方yum源
RPM-UVH http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# # #更新系统证书模块和python到最新版本
Yum Upgrade Ca-certificates--disablerepo=epel-y
Yum Update python-y
# #服务端安装
# #yum Install Salt-master-y
# #客户端安装
Yum Install Salt-minion-y
# #替换默认的master服务器IP
#sed-i ' s/#master: salt/master:10.100.60.52/g '/etc/salt/minion
#修改id号
#sed-i ' s/#id:/id:lcb-p-wbs02-60.4/g '/etc/salt/minion
#/etc/init.d/salt-minion start
Examples of some common commands used:
Issuance of documents to the development machine (note, download_bag.sh in the root of the salt, the default/srv/salt, can also be changed by itself)
Salt ' * ' Cp.get_file salt://download_bag.sh/home/deployer/scripts/download_bag.sh
Modify file Permissions
Salt ' * ' cmd.run ' cd/home/deployer/scripts; Chown deployer:deployer *;chmod 755 * '
Remote execution of local script, return log (configuration details, Salt-master server/srv/salt directory)
Example: Salt ' lcb-u-touch02-123 ' State.sls touch-webapp/download_bag
TOP.SLS configuration:
Base
‘*‘:
-Touch-webapp/download_bag.init
Download_bag.init Configuration: Vi/srv/salt/touch-webapp/download_bag/init.sls
Shell_download:
Cmd.script:
-source:salt://touch-webapp/download_bag/download_bag.sh
-mode:755
-User:deployer
~
Salt installation and use of some notes