• salt安装及使用部分笔记


    安装脚本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

    使用的一些常用命令举例:

      下发文件到制定机器(注释,download_bag.sh放在salt的根目录下,默认/srv/salt,,也可自行更改)
      salt '*' cp.get_file salt://download_bag.sh /home/deployer/scripts/download_bag.sh
      修改文件权限
      salt '*' cmd.run 'cd /home/deployer/scripts; chown deployer:deployer *;chmod 755 *'

      远程执行本地脚本,返回日志(配置详情,salt-master服务器/srv/salt目录)
      示例:salt 'LCB-U-touch02-123' state.sls touch-webapp/download_bag
     top.sls配置: 
    base:
      '*':
        - touch-webapp/download_bag.init

     download_bag.init配置: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
    ~

  • 相关阅读:
    【足迹C++primer】32、定制操作_2
    pom文件miss artifact com.sun:tools:jar:1.5.0:system问题
    cents上运行wget报错:unable to resolve host address
    怎样定义函数模板
    06006_redis数据存储类型——String
    雷林鹏分享:C# 类型转换
    雷林鹏分享:C# 运算符
    雷林鹏分享:C# 循环
    雷林鹏分享:C# 判断
    雷林鹏分享:C# 方法
  • 原文地址:https://www.cnblogs.com/franjia/p/5852526.html
Copyright © 2020-2023  润新知