debugMinor
Ansible Expect module times out; unable to end play or move to another module
Viewed 0 times
moduleunablemoveexpectplayanotherendtimesansibleout
Problem
I've noticed that the expect module will always time out and cause an
How can I end the expect module and move to the next one?
TASK [Disk Unassignment] *
task path: /home/sansible/ansible/disk-unassign.yaml:13
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "telnet '10.233.82.7' '2045'", "delta": "0:05:07.775726", "end": "2018-03-22 12:30:52.315879", "msg": "non-zero return code", "rc": 1, "start": "2018-03-22 12:25:44.540153", "stdout": "Trying 10.233.82.7...\r\r\nConnected to 10.233.82.7.\r\r\nEscape character is '^]'.\r\r\necho\r\nConnected to port 45. \r\necho\r\nInvalid command: \"echo\"\r\nAvailable commands: version, update_flash, netboot, boot_diags, boot_backup, boot_primary, boot_ontap, sp, flash, bye, set, lsmod, autoboot, go, boot, load, ndp, ping, arp, ifconfig, show, savenv, saveenv, unsetenv, set-defaults, setenv, printenv, help\r\n\r\nError (errcode=-1)\r\nLOADER-A> boot_diags\r\nLoading X86_64/freebsd/image1/kernel:0x200000/10377184 0xbe57e0/6364864 Entry at 0x80294c20\r\nLoading X86_64/freebsd/image1/platform.ko:0x11f8000/2512792 0x145e798/393448 0x14be880/541680 \r\nStarting program at 0x80294c20\r\nNetApp Data ONTAP 9.1RC2X9\r\nInvalid config, overriding as ignore_chassis_config is set \r\n\r\nTrying to mount root from msdosfs:/dev/da0s1 [ro]...\r\nmd0 attached to /X86_64/
rc=1 code. It's doing everything that I want it to, I just want to move to another module.How can I end the expect module and move to the next one?
tasks:
- name: Disk Unassignment
expect:
echo: yes
timeout: 180
command: telnet '{{ terms }}' '{{ termp }}'
responses:
Escape character is: "echo"
Error: "boot_diags"
Continue with boot?: "yes"
root logged: "disk remove_ownership all"
Do you: "yes"
Volumes: "yes"
- meta: end_playTASK [Disk Unassignment] *
task path: /home/sansible/ansible/disk-unassign.yaml:13
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "telnet '10.233.82.7' '2045'", "delta": "0:05:07.775726", "end": "2018-03-22 12:30:52.315879", "msg": "non-zero return code", "rc": 1, "start": "2018-03-22 12:25:44.540153", "stdout": "Trying 10.233.82.7...\r\r\nConnected to 10.233.82.7.\r\r\nEscape character is '^]'.\r\r\necho\r\nConnected to port 45. \r\necho\r\nInvalid command: \"echo\"\r\nAvailable commands: version, update_flash, netboot, boot_diags, boot_backup, boot_primary, boot_ontap, sp, flash, bye, set, lsmod, autoboot, go, boot, load, ndp, ping, arp, ifconfig, show, savenv, saveenv, unsetenv, set-defaults, setenv, printenv, help\r\n\r\nError (errcode=-1)\r\nLOADER-A> boot_diags\r\nLoading X86_64/freebsd/image1/kernel:0x200000/10377184 0xbe57e0/6364864 Entry at 0x80294c20\r\nLoading X86_64/freebsd/image1/platform.ko:0x11f8000/2512792 0x145e798/393448 0x14be880/541680 \r\nStarting program at 0x80294c20\r\nNetApp Data ONTAP 9.1RC2X9\r\nInvalid config, overriding as ignore_chassis_config is set \r\n\r\nTrying to mount root from msdosfs:/dev/da0s1 [ro]...\r\nmd0 attached to /X86_64/
Solution
Tensibai was correct, the telnet session in the
Holding down the key combination Ctrl+] to exit wasn't going to work, so an optional escape character was chosen in the telnet command like so:
expect module had to end. Holding down the key combination Ctrl+] to exit wasn't going to work, so an optional escape character was chosen in the telnet command like so:
telnet -e ! 10.224.223.10Code Snippets
telnet -e ! 10.224.223.10Context
StackExchange DevOps Q#3688, answer score: 4
Revisions (0)
No revisions yet.