Hi Dears,
My remote hosts’ management port is serial console over LAN.
When connect by ssh manually, I use ops account connect to remote hosts, and then it become the Linux console, I just run ssh command.
Now, I use ansible -m ping to test reachable, it reports:
“Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in …”
yes, it should report this error, because this is not real ssh session, it is console.
is there any method to modify the reachable test command? or do you have any suggestion for serial console over LAN?
Thanks.
Ansible expects to run python scripts remotely, so it requires a transport (SSH) and the ability to run python.
In your case I assume you connect over SSH to an out-of-band management board (using its own credentials) then get a serial console and then you have to log on again on the console prompt.
This is not supported by Ansible at the moment, but is not impossible to implement. Although there are pitfalls you have to consider (eg. someone already logged in on that same console, or not having properly logged out due to unexpected disconnect).
Yes, you said totally right, it is exactly my problem. I have tried your suggestion, someone already logged on that same console.
but ansible still reports Authentication or permission failure.
now, I want to study ansible’s source code, try to rewrite the code after initial connection. it should send a ‘enter’ key, and try to login if the console is not logged on.
thank you for your help, I will update my trial later.
Hi Don,
Hm.. finally, I wrote a python script which reads jinja2 commands
template to generate shell commands and run generated commands by
pyexpect.
Then, run this python script on ansible controller host, we have
several ways to do that, similar with the method mentioned by Andrew
above, or using local_action to call the python script.
Thanks.
Andrew Latham <lathama@gmail.com> 于2018年10月25日周四 上午3:11写道: