首页 > 其他 > 详细

ansible saltstack 命令简单对比

时间:2018-02-22 19:16:58      阅读:213      评论:0      收藏:0      [点我收藏+]

salt

ansible

服务安装

salt h112  pkg.install nginx

ansible h112 -m apt -a "name=nginx state=present"

服务停止

salt h112 service.stop nginx

ansible h112 -m service -a "name=nginx state=stopped"

运行命令

salt h112 cmd.run 'w'

ansible h112 -m command -a "w"

运行命令 服务相关

salt h112 cmd.run 'service nginx restart'

ansible h112 -m command -a "service nginx restart"

文件

salt-cp  h112  file     slave-hosts-dir

ansible h112 -m copy -a "src=/a/b dest=/b/c"

目录

复杂,用sls





客户端识别

客户机配置文件中的id生成minion_id , 主机中salt-key查看客户端主机名,并列表/正则等匹配

主 配置host文件 ip或 域名




sls playbook

/srv/salt/web/apache.sls

技术分享图片

/xxx/web/apache.playbook

ansible-playbook  ntp.yml  --syntax --check  #语法检查

技术分享图片




调用

salt h112 state.sls web.apache

ansible-playbok  /xxx/web/apache

高级

技术分享图片

salt '*' state.highstate test=True  #执行前 test=True

role方式,目录方式。


ansible saltstack 命令简单对比

原文:http://blog.51cto.com/13606158/2072133

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!