一千萬個為什麽

搜索

Ansible Expect模塊超時;無法結束播放或移動到另一個模塊



我註意到expect模塊總是超時並導致 rc = 1 代碼。它正在做我想要的所有事情,我只想轉移到另一個模塊。

如何結束expect模塊並轉到下一個模塊?

  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\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/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

轉載註明原文: Ansible Expect模塊超時;無法結束播放或移動到另一個模塊

一共有 1 個回答:

Tensibai是正確的,期望模塊中的telnet會話必須結束。

按住組合鍵“Ctrl +]”退出不起作用,因此在telnet命令中選擇了一個可選的轉義字符。

例如telnet -e! 10.224.223.10