I was automating the shibboleth 3 IDP installer in Ansible and came across expect-lite (apt-get install expect-lite). It's a minimal wrapper around expect - a tool used for automating interactive command line apps.
>./install.sh
>
>
>sso-dr.lesmills.net.au
>https://sso-dr.lesmills.net.au/idp/shibboleth
>lesmills.net.au
>xxx
>xxx
>xxx
>xxx
In a nutshell - simple syntax, seems to do the job well (well worth adding to the toolbox)! When combined with Ansible templates it offers a simple was to perform automated installations (across our dev/test/prod environments).
I originally wanted to use the Ansible http://docs.ansible.com/ansible/expect_module.html, but the version of ansible I was running was a bit out of date.