首页 > 其他分享 >SaltStack 八

SaltStack 八

时间:2022-11-25 12:02:44浏览次数:44  
标签:root salt 192.168 host ssh SaltStack pts


# salt-ssh systemctl stop salt-minion
1. yum install -y salt-ssh

2. vim /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
node1:
host: 192.168.2.104
user: root
passwd: 19920308shibin
port: 22

node2:
host: 192.168.2.103
user: root
passwd: 19920308shibin
port: 22

3. salt-ssh '*' test.ping -i
4. salt-ssh '*' -r 'w'
# 执行效果如下:
#---------------------------------------------------------------------------
node2:
----------
retcode:
0
stderr:
stdout:
[email protected]'s password:
01:09:20 up 2:20, 3 users, load average: 0.10, 0.16, 0.21
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 07:48 ? 0.38s 0.38s -bash
root pts/0 192.168.2.101 23:45 8.00s 0.74s 0.02s /usr/bin/python /usr/bin/salt-ssh * -r w
root pts/1 192.168.2.101 23:54 22:08 0.39s 0.39s -bash
node1:
----------
retcode:
0
stderr:
stdout:
[email protected]'s password:
06:56:25 up 11:47, 3 users, load average: 0.00, 0.04, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 19:09 1:24m 2.27s 2.27s -bash
root pts/0 192.168.2.101 05:32 21:37 1.39s 1.39s -bash
root pts/1 192.168.2.101 05:42 55:21 1.09s 1.09s -bash

#---------------------------------------------------------------------------

标签:root,salt,192.168,host,ssh,SaltStack,pts
From: https://blog.51cto.com/u_13940603/5886227

相关文章

  • SaltStack 七
    #saltRedis部署/srv/salt/prod/├──modules│├──apache│├──haproxy│├──keepalived│├──mysql│└──redis│└──redis-......
  • SaltStack 六
    #salt本地管理无master架构#file_client:remote#将remote改为localsalt-call--localstate.slsweb.tomcat#zabbix-agent案例/srv/salt/├──base#......
  • SaltStack 五
    #salt的生产实践不推荐使用file目录模块模块进行代码部署不建议salt管理项目的配置文件,建议分层管理,salt只管理应用服务若有固定的文件服务器,可以使用source:......
  • SaltStack 四
    #Apache监听本地IP地址结合jinjia模板变量使用Grains:{{grains['fqdn_ip4'][0]}}变量使用执行模块:{{salt['network.hw_addr']('eth0')}}变量使用Pillar:{{pil......
  • SaltStack 三
    #salt数据系统:Grains&Pillar#Minion启动时收集(静态数据)#grains应用场景:grains可以再salt系统中用于配置管理模块Grains可以以target中使用,用来匹配Minion......
  • SaltStack 二
    #Tomcat安装管理1.vimtomcat.slsjdk-install:pkg.installed:-name:java-1.8.0-openjdktomcat-install:file.managed:-name:/usr/local/src/apache-tomc......
  • saltstack服务端与客户端通信问题处理
    jenkins发布报错:ERROR:NoreturnreceivedNominionsmatchedthetarget.Nocommandwassent,nojidwasassigned.saltstack分为服务端master与客户端minion配置文......