Don't know what is causing the error with expect

58 views
Skip to first unread message

Mark Constant

unread,
Jan 15, 2016, 11:36:20 AM1/15/16
to Ansible Project
I don't know why my expect command below is not working. I used the regex format tester before doing this.
  - name: Install Rhapsody
    become: no
    expect:
     command: /tmp/rhapsody-6_2_0-linux-x64.sh
     echo: yes
     responses:
      (^)(?i)OK(.*): "o"
      (^)(?i)Where should Rhapsody be installed(.*): "/rhapsody/rhapsody62/"
      (^)(?i)Where should the data directory be located(.*): "/rhapsody/rhapsody62/rhapsody/data"
      (^)(?i)What memory setting should be used(.*): "2048"
      (^)(?i)What port settings should be used(.*): "3042"
      (^)(?i)Secure Web Management Console Port(.*): "8445"
      (^)(?i)Secure Management Webservice Port(.*): "8450"

I get the following error
*
fatal: [172.16.120.199]: FAILED! => {"changed": true, "cmd": "/tmp/rhapsody-6_2_0-linux-x64.sh", "delta": "0:00:30.341323", "end": "2016-01-15 11:25:38.460602", "failed": true, "rc": 1, "start": "2016-01-15 11:25:08.119279", "stdout": "Unpacking JRE ...\r\nPreparing JRE ...\r\nStarting Installer ...\r\nThis will install Rhapsody 6.2.0 on your computer.\r\nOK [o, Enter], Cancel [c]", "stdout_lines": ["Unpacking JRE ...", "Preparing JRE ...", "Starting Installer ...", "This will install Rhapsody 6.2.0 on your computer.", "OK [o, Enter], Cancel [c]"]}

When I run the command manually the first thing that comes up is
Unpacking JRE ...
Preparing JRE ...
Starting Installer ...
This will install Rhapsody 6.2.0 on your computer.
OK [o, Enter], Cancel [c]



Matt Martz

unread,
Jan 15, 2016, 11:48:06 AM1/15/16
to ansible...@googlegroups.com
Does it actually install when using the expect module?  It seems as though the failure is because you are getting a return code of 1.  If it does install, it might indicate that an rc of 1 is not a failure.

What is the return code after you run it manually/interactively?

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5550514f-0ee0-49e1-b230-f0745fd71ca6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net

Mark Constant

unread,
Jan 15, 2016, 1:49:43 PM1/15/16
to Ansible Project
No it doesn't install. I am having a hard time figuring out what return code 1 means or how to get a return code when I do a manual install. This .sh file is a packaged installer from a vendor we use that I am trying to automate, so I don't have much insight into return codes.

Mark Constant

unread,
Jan 15, 2016, 4:23:43 PM1/15/16
to Ansible Project
I put in my script for every response question (.*) and now the script just sits there. What would be the correct python regex for capturing everything including new line? At this point I am just trying to grab anything to see if there issue is the response questions.

Mark Constant

unread,
Jan 15, 2016, 4:30:51 PM1/15/16
to Ansible Project
I got it going. I basically used the last word in the question and put (.*$) after it.
Reply all
Reply to author
Forward
0 new messages