On Wed, Feb 05, 2020 at 01:05:57AM -0800, Gerhard Van Der Wath wrote:
> Hi.
Hi, if you had posted a plain text mail instead of HTML you would have gotten a
replay a lot sooner.
As you can see bellow you formatting is hard to read.
> tasks:
>
> - name: Get CPU load
> expect:
> command: ssh admin@#########
> responses:
> 'password: ':
> - #######
> '#':
> - sh platform cpu-load
>
>
>
> Error:
>
> fatal: [######]: FAILED! => { "changed": false, "invocation": {
> "module_args": { "chdir": null, "command": "ssh admin@######", "creates":
> null, "echo": false, "removes": null, "responses": { "#": [ "sh platform
> cpu-load" ], "password: ": [ "######" ] }, "timeout": 30 } }, "msg": "No
> remaining responses for '#', output was ' sh platform
> cpu-load\r\nTimestamp: 10:49:41 Wed 2020-02-05\r\nTotal load : 4%\r\nCPU 00
> load : 5%\r\nCPU 01 load : 3%\r\nCPU 02 load : 5%\r\nCPU 03 load :
> 5%\r\nVOXBDLHA1#'" }
As the msg says expect has gotten a prompt # put have no more command to give.
Remember that expect is you substitute for a human typing inn commands, so you
need to provide all command from start, ssh in you case, to the exit of the ssh
command.
So you need to add an element to the item "#" in your responses to exit the
command.
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/20200211113332.l6sb4feyxlgdtduo%40olstad.com.