zoukankan      html  css  js  c++  java
  • salt Rosters

    salt除了支持Master 和Minion方式之外,还支持SSH; SSH方式因为没有minion主动连接master,所以需要维护 roster,提供master可以操作的对象;roster的配置文件默认在:/etc/sat/roster

    [root@linux-node1 ~]# cat /etc/salt/roster 
    # Sample salt-ssh config file
    #web1:
    #  host: 192.168.42.1 # The IP addr or DNS hostname
    #  user: fred         # Remote executions will be executed as user fred
    #  passwd: foobarbaz  # The password to use for login, if omitted, keys are used
    #  sudo: True         # Whether to sudo to root, not enabled by default
    #web2:
    #  host: 192.168.42.2
    
    linux-node1.oldboyedu.com:
      host: 192.168.74.20
      port: 22
      user: root
        
    linux-node2.oldboyedu.com:
      host: 192.168.74.32
      port: 22
      user: root
    # priv: /root/.ssh/id_rsa
    

    如果在roster的配置文件中没有写入私钥文件或者密码,第一次操作的时候,需要写入密码

    [root@linux-node1 ~]# salt-ssh '*' test.ping  -i
    

    之后就可以正常操作了

    [root@linux-node1 ~]# salt-ssh '*' test.ping  
    linux-node1.oldboyedu.com:
        True
    linux-node2.oldboyedu.com:
        True
    [root@linux-node1 ~]# salt-ssh '*' cmd.run 'uptime'
    linux-node1.oldboyedu.com:
         16:08:30 up 12:09,  1 user,  load average: 0.01, 0.03, 0.05
    linux-node2.oldboyedu.com:
         16:08:26 up  8:15,  1 user,  load average: 0.19, 0.11, 0.07
    
    
    [root@linux-node1 ~]# salt-ssh '*'  -r 'uptime'
    linux-node1.oldboyedu.com:
        ----------
        retcode:
            0
        stderr:
        stdout:
             16:09:14 up 12:09,  1 user,  load average: 0.00, 0.03, 0.05
    linux-node2.oldboyedu.com:
        ----------
        retcode:
            0
        stderr:
        stdout:
             16:09:11 up  8:15,  1 user,  load average: 0.15, 0.11, 0.07
    
    
    [root@linux-node1 ~]# salt-ssh '*' state.sls salt.init_repo   #和salt的操作相同
    

      

      

  • 相关阅读:
    36-图像有用区(dfs, bfs)
    35-迷宫寻宝(一)-NYOJ82
    34- 24 Point game
    32-回文字符串(dp)
    71-n皇后
    70-合并数字
    2017.11.18 C语言的算法分析题目
    2017.11.17 C++系列---用malloc动态给c++二维数组的申请与释放操作
    2017.11.16 JavaWeb-------第八章 EL、JSTL、Ajax技术
    2017.11.15 JavaWeb的学生体质管理系统
  • 原文地址:https://www.cnblogs.com/cqq-20151202/p/7009417.html
Copyright © 2011-2022 走看看