salt-ssh的使用(不需要安装客户端)

简介:

什么情况下才使用salt-ssh,有一些比较老的红帽服务器,也有一些不方便安装salt-minion客户端。总会有一些服务器比较难安装上salt-minion的。

好了,下面来说说简单配置


默认使用roster配置文件

vim /etc/salt/roster 

1
2
3
4
5
6
7
8
9
10
11
12
13
# 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
hdd:                               //ID 名字可以随便定义
   host: 10.0.0.221
   user: hdd
   passwd : 66666
   sudo : Ture

已经完成配置!下面直接使用salt-ssh

第一次运行没有添加-i,未能如期运行。

1
2
3
4
5
6
7
8
9
10
11
12
root@salt-master ~] # salt-ssh "*" -r 'free -m'
hdd:
     ----------
     retcode:
         254
     stderr:
     stdout:
         The host key needs to be accepted, to auto accept run salt- ssh  with the -i flag:
         The authenticity of host  '10.0.0.221 (10.0.0.221)'  can't be established.
         ECDSA key fingerprint is b9:36:f5:d8:3a:88:94:93:43:78:8e:cb:43:78:8e:cb.
         Are you sure you want to  continue  connecting ( yes /no )? 
[root@salt-master ~] #

添加-i参数继续执行命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[root@salt-master ~] # salt-ssh "*" -r 'free -m' -i
hdd:
     ----------
     retcode:
         0
     stderr:
         Warning: Permanently added  '10.0.0.221'  (ECDSA) to the list of known hosts.
     stdout:
         hdd@10.0.0.221's password: 
                      total       used        free      shared    buffers     cached
         Mem:          7856       6698       1157         18        317       4298
         -/+ buffers /cache :       2082       5773
         Swap:         8061          0       8061
[root@salt-master ~]
[root@salt-master ~] # salt-ssh "hdd" -r 'df -h'             
hdd:
     ----------
     retcode:
         0
     stderr:
     stdout:
         Filesystem      Size  Used Avail Use% Mounted on
         udev            3.9G  4.0K  3.9G   1%  /dev
         tmpfs           786M  1.5M  785M   1%  /run
         /dev/sda1        910G  454G  410G  53% /
         none            4.0K     0  4.0K   0%  /sys/fs/cgroup
         none            5.0M     0  5.0M   0%  /run/lock
         none            3.9G   84K  3.9G   1%  /run/shm
         none            100M   12K  100M   1%  /run/user

但是我有一个问题,保存的密钥放在哪里呢?暂时我未有发现。


本文转自 yanconggod 51CTO博客,原文链接:http://blog.51cto.com/yanconggod/1876147


相关文章
|
4月前
|
Ubuntu Linux 网络安全
【计算机网络】SSH 服务安装
【1月更文挑战第10天】【计算机网络】SSH 服务安装
|
2月前
|
缓存 网络协议 数据可视化
WinSCP下载安装并实现远程SSH本地服务器上传文件
WinSCP下载安装并实现远程SSH本地服务器上传文件
|
6月前
|
Ubuntu 网络安全 Docker
Ubuntu 安装与配置ssh (docker)
Ubuntu 安装与配置ssh (docker)
116 0
|
6月前
|
Shell 网络安全 数据安全/隐私保护
debian安装ssh(傻瓜教程)+证书免密登录
debian安装ssh(傻瓜教程)+证书免密登录
380 0
|
6月前
|
jenkins 持续交付 网络安全
Jenkins安装SSH插件
Jenkins安装SSH插件
77 0
|
7月前
|
网络协议 安全 Shell
如何在 SSH 客户端中强制使用 IPv4 或 IPv6?
如何在 SSH 客户端中强制使用 IPv4 或 IPv6?
457 0
如何在 SSH 客户端中强制使用 IPv4 或 IPv6?
|
7月前
|
Linux 网络安全 开发工具
百度搜索:蓝易云【Git安装 + 多站点SSH Key配置教程。】
现在,你已经成功安装了Git,并配置了多站点的SSH Key。你可以使用Git命令进行版本控制,并通过SSH Key进行身份验证来访问不同的Git仓库。
153 0
|
9月前
|
运维 Ubuntu Linux
【树莓派4B安装18.04桌面+远程SSH】
【树莓派4B安装18.04桌面+远程SSH】
265 0
|
7月前
|
Ubuntu Linux 网络安全
SSH客户端连接远程服务器
一、什么是客户端连接远程服务器 发起连接的一方,计算机或设备(称为客户端)与另一个计算机或设备(称为远程服务器)建立连接。 客户端通过网络连接到远程服务器,远程服务器则是提供所需服务或资源的一方。 客户端通常使用特定的协议(如SSH、HTTP、FTP等)与远程服务器进行通信。 示例:你使用SSH客户端从本地计算机连接到远程服务器以执行远程命令。 二、什么是服务端连接远程服务器
208 1
|
4月前
|
网络协议 安全 网络安全
Android Termux安装SSH结合内网穿透实现远程SFTP文件传输
Android Termux安装SSH结合内网穿透实现远程SFTP文件传输
55 0