salt自动化部署

时间:2023-02-08 16:30:24

1. 到编译机器编译

/export/Deploy/vm-agent

执行脚本

./vm-agent.sh develop -alpha

2.检查rpm包是否打包成功

http://172.18.138.56/x86_64/

3. 检查项目配置文件

/export/Data/salt/xeniumd/vm-agent/alpha

4. 使用salt部署

部署,超时时间30秒

salt -N  kvm-alpha-node  state.highstate -t  

部署完成后使用命令启动程序

 salt -N  kvm-alpha-node  cmd.run "systemctl restart vm-agent-alpha"

启动完成后检测状态是否启动

salt -N  kvm-alpha-node  cmd.run "systemctl status vm-agent-alpha"   | grep running

5. salt其他命令

//推送文件
salt -N docker cp.get_file salt://init/win2008.img /etc/aaa //批量执行命令
salt -N docker cmd.run "ls -al"
salt -N docker cmd.run "md5sum win2008.img"

//批量安装, 前提修改相应地/export/Data/salt/top.sls
salt -N docker state.highstate //批量安装好, 要检查进程的状态
salt -N docker cmd.run "systemctl status vm-api" | grep running | wc -l
salt 批量检查程序rpm包版本
salt -N test-api cmd.run "rpm -qa xeniumd-api-test" -t
salt -N kvm-server-node- cp.get_file salt://init/jcloud.repo /etc/yum.repos.d/jcloud.repo