标签:saltstack
什么情况下才使用salt-ssh,有一些比较老的红帽服务器,也有一些不方便安装salt-minion客户端。总会有一些服务器比较难安装上salt-minion的。
好了,下面来说说简单配置
默认使用roster配置文件
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 hdd: //ID名字可以随便定义 host: 10.0.0.221 user: hdd passwd: 66666 sudo: Ture
已经完成配置!下面直接使用salt-ssh
第一次运行没有添加-i,未能如期运行。
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参数继续执行命令
[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
但是我有一个问题,保存的密钥放在哪里呢?暂时我未有发现。
本文出自 “天地冰寂” 博客,请务必保留此出处http://yanconggod.blog.51cto.com/1351649/1876147
标签:saltstack
原文地址:http://yanconggod.blog.51cto.com/1351649/1876147