Answers: <p>Tensibai was correct, the telnet session in the <code>expect</code> module had to end. </p>
  
  <p>Holding down the key combination <kbd>Ctrl</kbd>+<kbd>]</kbd> to exit wasn't going to work, so an optional escape character was chosen in the telnet command like so:</p>
  
  <pre><code>telnet -e ! 10.224.223.10
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2018-03-23T12:21:02.610Z
Answers: 2018-08-17T20:57:54.890Z
Answers: 2018-08-17T20:57:54.890Z
Answers: wabbajack001
Body: <p>I've noticed that the expect module will always time out and cause an <code>rc=1</code> code. It's doing everything that I want it to, I just want to move to another module.</p>
  
  <p>How can I end the expect module and move to the next one? </p>
  
  <pre><code>  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_play
  </code></pre>
  
  <blockquote>
    <p>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\n<strong>Invalid config, overriding as ignore_chassis_config is set</strong> \r\n\r\nTrying to mount root from msdosfs:/dev/da0s1 [ro]...\r\nmd0 attached to /X86_64/freebsd/image1/rootfs.img\r\nTrying to mount root from ufs:/env/md0.uzip []...\r\nmountroot: waiting for device /env/md0.uzip ...\r\nCopyright (C) 1992-2016 NetApp.\r\nAll rights reserved.\r\nWriting loader environment to the boot device.\r\nLoader environment has been saved to the boot device.\r\n*******************************\r\n*                             <em>\r\n</em> Press Ctrl-C for Boot Menu. <em>\r\n</em>                             *\r\n*******************************  \t\r\nNo SVM keys found.\r\nFirewall rules loaded.\r\nIpspace \"ACP\" created\r\nWAFL CPLEDGER is enabled. Checklist = 0x7ff841ff\r\nadd host 127.0.10.1: gateway 127.0.20.1\r\n5\r\n\r\n\tNOTE: You have chosen to boot the diagnostics kernel.\r\n\tUse the 'sldiag' command in order to run diagnostics on the system.\r\n\r\n\r\n\tYou have selected the maintenance boot option:\r\n\tthe system has booted in maintenance mode allowing the\r\n\tfollowing operations to be performed:\r\n\r\n\t?                 \tacorn             \r\n\tacpadmin          \taggr              \r\n\tcna_flash         \tdisk              \r\n\tdisk_latency      \tdisk_list         \r\n\tdisk_mung         \tdisk_shelf        \r\n\tdiskcopy          \tdisktest          \r\n\tdumpblock         \tenvironment       \r\n\tfcadmin           \tfcstat            \r\n\tfctest            \tfru_led           \r\n\tha-config         \thalt              \r\n\thelp              \tifconfig          \r\n\tkey_manager       \tled_off           \r\n\tled_on            \tnicadmin          \r\n\tnv8               \traid_config       \r\n\tsasadmin          \tsasstat           \r\n\tscsi              \tsesdiag           \r\n\tsldiag            \tstorage           \r\n\tstsb              \tsysconfig         \r\n\tsystemshell       \tucadmin           \r\n\tversion           \tvmservices        \r\n\tvol               \tvol_db            \r\n\tvsa               \txortest           \r\n\r\n\tType \"help \" for more details.\r\n\r\n\r\n\tIn a High Availablity configuration, you MUST ensure that the \r\n\tpartner node is (and remains) down, or that takeover is manually \r\n\tdisabled on the partner node, because High Availability \r\n\tsoftware is not started or fully enabled in Maintenance mode.\r\n\r\n\tFAILURE TO DO SO CAN RESULT IN YOUR FILESYSTEMS BEING DESTROYED\r\n\r\n\tNOTE: It is okay to use 'show/status' sub-commands such as\r\n\t'disk show or aggr status' in Maintenance mode while the partner is up\r\nContinue with boot? yes\r\nyes\r\n\r\n\r\nMar 22 12:24:22 [rtpsb-f6280-01-01:acp.need.firmware.update:info]: ACP module  (NA) needs a firmware upgrade, (disk shelf serial number: SHJ0000000152A6). \r\n\rMar 22 12:24:22 [rtpsb-f6280-01-01:acp.need.firmware.update:info]: ACP module  (NA) needs a firmware upgrade, (disk shelf serial number: SHJ0000000152A6). \r\n\r\r\nThu Mar 22 12:24:49 EDT 2018\r\n*> Mar 22 12:24:49 [rtpsb-f6280-01-01:kern.syslog.msg:notice]: root logged in from SP\r\n \r\n\rdisk remove_ownership all\r\nAll disks will have their ownership information removed.\r\nFor high availability (HA) configurations, the partner node must be down.\r\nDo you wish to continue? yes\r\nVolumes must be taken offline. Are all impacted volumes offline(y/n)?? yes\r\n*> ", "stdout_lines": ["Trying 10.233.82.7...", "", "Connected to 10.233.82.7.", "", "Escape character is '^]'.", "", "echo", "Connected to port 45. ", "echo", "Invalid command: \"echo\"", "Available 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", "", "Error (errcode=-1)", "LOADER-A> boot_diags", "Loading X86_64/freebsd/image1/kernel:0x200000/10377184 0xbe57e0/6364864 Entry at 0x80294c20", "Loading X86_64/freebsd/image1/platform.ko:0x11f8000/2512792 0x145e798/393448 0x14be880/541680 ", "Starting program at 0x80294c20", "NetApp Data ONTAP 9.1RC2X9", "<strong>Invalid config, overriding as ignore_chassis_config is set</strong> ", "", "Trying to mount root from msdosfs:/dev/da0s1 [ro]...", "md0 attached to /X86_64/freebsd/image1/rootfs.img", "Trying to mount root from ufs:/env/md0.uzip []...", "mountroot: waiting for device /env/md0.uzip ...", "Copyright (C) 1992-2016 NetApp.", "All rights reserved.", "Writing loader environment to the boot device.", "Loader environment has been saved to the boot device.", "*******************************", "*                             <em>", "</em> Press Ctrl-C for Boot Menu. <em>", "</em>                             *", "*******************************  \t", "No SVM keys found.", "Firewall rules loaded.", "Ipspace \"ACP\" created", "WAFL CPLEDGER is enabled. Checklist = 0x7ff841ff", "add host 127.0.10.1: gateway 127.0.20.1", "5", "", "\tNOTE: You have chosen to boot the diagnostics kernel.", "\tUse the 'sldiag' command in order to run diagnostics on the system.", "", "", "\tYou have selected the maintenance boot option:", "\tthe system has booted in maintenance mode allowing the", "\tfollowing operations to be performed:", "", "\t?                 \tacorn             ", "\tacpadmin          \taggr              ", "\tcna_flash         \tdisk              ", "\tdisk_latency      \tdisk_list         ", "\tdisk_mung         \tdisk_shelf        ", "\tdiskcopy          \tdisktest          ", "\tdumpblock         \tenvironment       ", "\tfcadmin           \tfcstat            ", "\tfctest            \tfru_led           ", "\tha-config         \thalt              ", "\thelp              \tifconfig          ", "\tkey_manager       \tled_off           ", "\tled_on            \tnicadmin          ", "\tnv8               \traid_config       ", "\tsasadmin          \tsasstat           ", "\tscsi              \tsesdiag           ", "\tsldiag            \tstorage           ", "\tstsb              \tsysconfig         ", "\tsystemshell       \tucadmin           ", "\tversion           \tvmservices        ", "\tvol               \tvol_db            ", "\tvsa               \txortest           ", "", "\tType \"help \" for more details.", "", "", "\tIn a High Availablity configuration, you MUST ensure that the ", "\tpartner node is (and remains) down, or that takeover is manually ", "\tdisabled on the partner node, because High Availability ", "\tsoftware is not started or fully enabled in Maintenance mode.", "", "\tFAILURE TO DO SO CAN RESULT IN YOUR FILESYSTEMS BEING DESTROYED", "", "\tNOTE: It is okay to use 'show/status' sub-commands such as", "\t'disk show or aggr status' in Maintenance mode while the partner is up", "Continue with boot? yes", "yes", "", "", "Mar 22 12:24:22 [rtpsb-f6280-01-01:acp.need.firmware.update:info]: ACP module  (NA) needs a firmware upgrade, (disk shelf serial number: SHJ0000000152A6). ", "", "Mar 22 12:24:22 [rtpsb-f6280-01-01:acp.need.firmware.update:info]: ACP module  (NA) needs a firmware upgrade, (disk shelf serial number: SHJ0000000152A6). ", "", "", "Thu Mar 22 12:24:49 EDT 2018", "<em>> Mar 22 12:24:49 [rtpsb-f6280-01-01:kern.syslog.msg:notice]: root logged in from SP", " ", "", "disk remove_ownership all", "All disks will have their ownership information removed.", "For high availability (HA) configurations, the partner node must be down.", "Do you wish to continue? yes", "Volumes must be taken offline. Are all impacted volumes offline(y/n)?? yes", "</em>> "]}
                to retry, use: --limit @/home/sansible/ansible/disk-unassign.retry</p>
    
    <p>PLAY RECAP *****************************************************************************************************************************************************************************************
    localhost                  : ok=0    changed=0    unreachable=0    failed=1</p>
  </blockquote>
  
Comments: CC BY-SA 3.0
Comments: 2018-03-21T13:23:50.337Z
Comments: Try to run your telnet command without ansible and verify it's expecting exactly those 6 responses .. seems that expect is still awaiting for one of those inputs to be rendered until timeout.
Comments: storm
Comments: CC BY-SA 3.0
Comments: 2018-03-21T13:25:38.307Z
Comments: Also run your play in debug mode `-vv` and add this task output to the question so we can see what happened there.
Comments: storm
Comments: CC BY-SA 3.0
Comments: 2018-03-22T13:18:50.340Z
Comments: You're starting a telnet command... which won't end by itself unless you tell the remote system you're ending up the communication... Obviously, the session waits for another command and the module stop it once the time is out for it to run. You should add something like  `>: "exit"`in your steps...
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2018-03-22T13:19:31.187Z
Comments: I've watched the console output and all of the response/answers have been matched. I'm not sure how to end the playbook successfully or move on to another module.
Comments: wabbajack001
Comments: CC BY-SA 3.0
Comments: 2018-03-22T14:10:17.283Z
Comments: You have to answer the last prompt with 'exit' or something like that.
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2018-03-22T15:30:02.913Z
Comments: Please use formatting, e.g. Ctrl + k
Comments: 030
Comments: CC BY-SA 3.0
Comments: 2018-03-22T18:08:24.107Z
Comments: Thanks Tensibai. I have to press and hold "Ctrl" and "]" to exit. This would be hard to mimic, so I'll change the exit prompt to a single letter instead with the -e option in the telnet command.
Comments: wabbajack001
Comments: CC BY-SA 3.0
Comments: 2018-03-22T18:19:50.983Z
Comments: This looks like a NetApp box. If so check your `telnet.distinct.enable` config, set it to `on` if needed and then you should be able to close the session with the `exit` command. See http://community.netapp.com/t5/Data-ONTAP-Discussions/How-to-quit-an-SSH-session-by-typing-exit/td-p/36521
Comments: Dan Cornilescu
Tags: <ansible>
Title: Ansible Expect module times out; unable to end play or move to another module
UserDisplayName: wabbajack001
ThreadText: # Ansible Expect module times out; unable to end play or move to another module
  
  (Asked by: username_0 on 2018-03-21)
  
  I've noticed that the expect module will always time out and cause an `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_play
  
  ```
  
  > 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\n**Invalid 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/freebsd/image1/rootfs.img\r\nTrying to mount root from ufs:/env/md0.uzip []...\r\nmountroot: waiting for device /env/md0.uzip ...\r\nCopyright (C) 1992-2016 NetApp.\r\nAll rights reserved.\r\nWriting loader environment to the boot device.\r\nLoader environment has been saved to the boot device.\r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\n\* *\r\n* Press Ctrl-C for Boot Menu. *\r\n* \*\r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \t\r\nNo SVM keys found.\r\nFirewall rules loaded.\r\nIpspace \"ACP\" created\r\nWAFL CPLEDGER is enabled. Checklist = 0x7ff841ff\r\nadd host 127.0.10.1: gateway 127.0.20.1\r\n5\r\n\r\n\tNOTE: You have chosen to boot the diagnostics kernel.\r\n\tUse the 'sldiag' command in order to run diagnostics on the system.\r\n\r\n\r\n\tYou have selected the maintenance boot option:\r\n\tthe system has booted in maintenance mode allowing the\r\n\tfollowing operations to be performed:\r\n\r\n\t? \tacorn \r\n\tacpadmin \taggr \r\n\tcna\_flash \tdisk \r\n\tdisk\_latency \tdisk\_list \r\n\tdisk\_mung \tdisk\_shelf \r\n\tdiskcopy \tdisktest \r\n\tdumpblock \tenvironment \r\n\tfcadmin \tfcstat \r\n\tfctest \tfru\_led \r\n\tha-config \thalt \r\n\thelp \tifconfig \r\n\tkey\_manager \tled\_off \r\n\tled\_on \tnicadmin \r\n\tnv8 \traid\_config \r\n\tsasadmin \tsasstat \r\n\tscsi \tsesdiag \r\n\tsldiag \tstorage \r\n\tstsb \tsysconfig \r\n\tsystemshell \tucadmin \r\n\tversion \tvmservices \r\n\tvol \tvol\_db \r\n\tvsa \txortest \r\n\r\n\tType \"help \" for more details.\r\n\r\n\r\n\tIn a High Availablity configuration, you MUST ensure that the \r\n\tpartner node is (and remains) down, or that takeover is manually \r\n\tdisabled on the partner node, because High Availability \r\n\tsoftware is not started or fully enabled in Maintenance mode.\r\n\r\n\tFAILURE TO DO SO CAN RESULT IN YOUR FILESYSTEMS BEING DESTROYED\r\n\r\n\tNOTE: It is okay to use 'show/status' sub-commands such as\r\n\t'disk show or aggr status' in Maintenance mode while the partner is up\r\nContinue with boot? yes\r\nyes\r\n\r\n\r\nMar 22 12:24:22 [rtpsb-f6280-01-01:acp.need.firmware.update:info]: ACP module (NA) needs a firmware upgrade, (disk shelf serial number: SHJ0000000152A6). \r\n\rMar 22 12:24:22 [rtpsb-f6280-01-01:acp.need.firmware.update:info]: ACP module (NA) needs a firmware upgrade, (disk shelf serial number: SHJ0000000152A6). \r\n\r\r\nThu Mar 22 12:24:49 EDT 2018\r\n\*> Mar 22 12:24:49 [rtpsb-f6280-01-01:kern.syslog.msg:notice]: root logged in from SP\r\n \r\n\rdisk remove\_ownership all\r\nAll disks will have their ownership information removed.\r\nFor high availability (HA) configurations, the partner node must be down.\r\nDo you wish to continue? yes\r\nVolumes must be taken offline. Are all impacted volumes offline(y/n)?? yes\r\n\*> ", "stdout\_lines": ["Trying 10.233.82.7...", "", "Connected to 10.233.82.7.", "", "Escape character is '^]'.", "", "echo", "Connected to port 45. ", "echo", "Invalid command: \"echo\"", "Available 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", "", "Error (errcode=-1)", "LOADER-A> boot\_diags", "Loading X86\_64/freebsd/image1/kernel:0x200000/10377184 0xbe57e0/6364864 Entry at 0x80294c20", "Loading X86\_64/freebsd/image1/platform.ko:0x11f8000/2512792 0x145e798/393448 0x14be880/541680 ", "Starting program at 0x80294c20", "NetApp Data ONTAP 9.1RC2X9", "**Invalid config, overriding as ignore\_chassis\_config is set** ", "", "Trying to mount root from msdosfs:/dev/da0s1 [ro]...", "md0 attached to /X86\_64/freebsd/image1/rootfs.img", "Trying to mount root from ufs:/env/md0.uzip []...", "mountroot: waiting for device /env/md0.uzip ...", "Copyright (C) 1992-2016 NetApp.", "All rights reserved.", "Writing loader environment to the boot device.", "Loader environment has been saved to the boot device.", "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*", "\* *", "* Press Ctrl-C for Boot Menu. *", "* \*", "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \t", "No SVM keys found.", "Firewall rules loaded.", "Ipspace \"ACP\" created", "WAFL CPLEDGER is enabled. Checklist = 0x7ff841ff", "add host 127.0.10.1: gateway 127.0.20.1", "5", "", "\tNOTE: You have chosen to boot the diagnostics kernel.", "\tUse the 'sldiag' command in order to run diagnostics on the system.", "", "", "\tYou have selected the maintenance boot option:", "\tthe system has booted in maintenance mode allowing the", "\tfollowing operations to be performed:", "", "\t? \tacorn ", "\tacpadmin \taggr ", "\tcna\_flash \tdisk ", "\tdisk\_latency \tdisk\_list ", "\tdisk\_mung \tdisk\_shelf ", "\tdiskcopy \tdisktest ", "\tdumpblock \tenvironment ", "\tfcadmin \tfcstat ", "\tfctest \tfru\_led ", "\tha-config \thalt ", "\thelp \tifconfig ", "\tkey\_manager \tled\_off ", "\tled\_on \tnicadmin ", "\tnv8 \traid\_config ", "\tsasadmin \tsasstat ", "\tscsi \tsesdiag ", "\tsldiag \tstorage ", "\tstsb \tsysconfig ", "\tsystemshell \tucadmin ", "\tversion \tvmservices ", "\tvol \tvol\_db ", "\tvsa \txortest ", "", "\tType \"help \" for more details.", "", "", "\tIn a High Availablity configuration, you MUST ensure that the ", "\tpartner node is (and remains) down, or that takeover is manually ", "\tdisabled on the partner node, because High Availability ", "\tsoftware is not started or fully enabled in Maintenance mode.", "", "\tFAILURE TO DO SO CAN RESULT IN YOUR FILESYSTEMS BEING DESTROYED", "", "\tNOTE: It is okay to use 'show/status' sub-commands such as", "\t'disk show or aggr status' in Maintenance mode while the partner is up", "Continue with boot? yes", "yes", "", "", "Mar 22 12:24:22 [rtpsb-f6280-01-01:acp.need.firmware.update:info]: ACP module (NA) needs a firmware upgrade, (disk shelf serial number: SHJ0000000152A6). ", "", "Mar 22 12:24:22 [rtpsb-f6280-01-01:acp.need.firmware.update:info]: ACP module (NA) needs a firmware upgrade, (disk shelf serial number: SHJ0000000152A6). ", "", "", "Thu Mar 22 12:24:49 EDT 2018", "*> Mar 22 12:24:49 [rtpsb-f6280-01-01:kern.syslog.msg:notice]: root logged in from SP", " ", "", "disk remove\_ownership all", "All disks will have their ownership information removed.", "For high availability (HA) configurations, the partner node must be down.", "Do you wish to continue? yes", "Volumes must be taken offline. Are all impacted volumes offline(y/n)?? yes", "*> "]}
  > to retry, use: --limit @/home/sansible/ansible/disk-unassign.retry
  >
  > PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  > localhost : ok=0 changed=0 unreachable=0 failed=1
  
  **Tags:** ansible
  
  > **Comments:**
  > **username_1**: Try to run your telnet command without ansible and verify it's expecting exactly those 6 responses .. seems that expect is still awaiting for one of those inputs to be rendered until timeout.  
  > **username_1**: Also run your play in debug mode `-vv` and add this task output to the question so we can see what happened there.  
  > **username_2**: You're starting a telnet command... which won't end by itself unless you tell the remote system you're ending up the communication... Obviously, the session waits for another command and the module stop it once the time is out for it to run. You should add something like  `>: "exit"`in your steps...  
  > **username_0**: I've watched the console output and all of the response/answers have been matched. I'm not sure how to end the playbook successfully or move on to another module.  
  > **username_2**: You have to answer the last prompt with 'exit' or something like that.  
  > **username_3**: Please use formatting, e.g. Ctrl + k  
  > **username_0**: Thanks username_2. I have to press and hold "Ctrl" and "]" to exit. This would be hard to mimic, so I'll change the exit prompt to a single letter instead with the -e option in the telnet command.  
  > **username_4**: This looks like a NetApp box. If so check your `telnet.distinct.enable` config, set it to `on` if needed and then you should be able to close the session with the `exit` command. See http://community.netapp.com/t5/Data-ONTAP-Discussions/How-to-quit-an-SSH-session-by-typing-exit/td-p/36521  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-03-23. Score: 4
  
  username_2 was correct, the telnet session in the `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.10
  
  ```
  
  
  ---
  
  