Salt - SSH using machine IP to execute commands, without having to write a roster file
In 2014.1.4 version I can specify the target machine execute commands, the target machine not written in the roster file command like this:
salt-ssh 'ip' test.ping --passwd rootpassword
ip:
True
But in 2015.5.3 version failed
result:
No hosts found with target ip of type glob
So.....In 2015.5.3 version,the target machine must be written in a roster file?
@double-yaya I was able to confirm that this is working on salt version 2014.1.4 and not working on salt version 2015.5.3. Thanks for your report.
Hi, i have the same issue, and found the answer.
salt-ssh --roster=scan 'IP' test.ping --user=SSH_USER --passwd=SSH_PASSWD
What is your version @yangxiangyu
salt-ssh 2015.5.2 (Lithium)
I am surprised this ever worked. The scan roster was always the intended solution here. The scan roster can also be used against a subnet if you want to go crazy. With the answer posted I am going to close this issue out
I run this command in salt-ssh 2015.8.8, return True:
sudo salt-ssh --user='root' --passwd='vagrant' --roster=scan '10.57.3.102' test.ping
the result is this:
10.57.3.102:
True
However, I run this by python api,return error:
from salt.client.ssh.client import SSHClient
client = SSHClient(c_path='/etc/salt/master')
print client.cmd(tgt='10.57.3.102', fun='test.ping', salt_user='root', salt_passwd='vagrant', roster='scan')
the error is this:
{'10.57.3.102': {'retcode': 255, 'stderr': 'Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n', 'stdout': ''}}
@thatch45 @double-yaya
The default vagrant user is vagrant
Why cmdline is OK, the python api is wrong?What's the difference between them?the root's password is 'vagrant', user+password matching is not enough?
Still wrong when I use vagrant/vagrant
Oh, I follow you now, sorry I read it too quickly the first time. This should work, I am not sure off the top of my head what is missing, but this should be a new issue, can you please open a new issue to track this please?
Ok
#35664 @thatch45