Unable use expect module in ansible to respond multiple times to a question with different answers.

Playbook -

  • name: starting splunk forwarder service
    expect:
    command: /opt/atlassian/bitbucket/atlassian-bitbucket-6.1.2-x64.bin
    responses:
    ‘Install a new instance [1, Enter], Upgrade an existing instance [2]’: ‘1’
    ‘Install a Server instance [1, Enter], Install a Data Center instance [2], Install a Smart Mirroring instance [3]’: ‘2’
    ‘Select the folder where you would like Bitbucket 6.1.2 to be installed, then click Next.’: ‘/opt/atlassian/bitbucket/6.1.2’
    ‘Ensure that this location is not used by another Bitbucket installation.’: ‘/var/atlassian/application-data/bitbucket’

Error-

TASK [starting splunk forwarder service] *******************************************************************************************************************************
fatal: [10.0.11.31]: FAILED! => {“changed”: true, “cmd”: “/opt/atlassian/bitbucket/atlassian-bitbucket-6.1.2-x64.bin”, “delta”: “0:00:30.132752”, “end”: “2019-03-29 07:53:36.157197”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2019-03-29 07:53:06.024445”, “stdout”: “Starting Installer …\r\n\u001b[?7h\r\nBitbucket 6.1.2 installation wizard\r\nWould you like to install or upgrade an instance?\r\nInstall a new instance [1, Enter], Upgrade an existing instance [2]”, “stdout_lines”: [“Starting Installer …”, “\u001b[?7h”, “Bitbucket 6.1.2 installation wizard”, “Would you like to install or upgrade an instance?”, “Install a new instance [1, Enter], Upgrade an existing instance [2]”]}
to retry, use: --limit @/infra_code/update-bitbucket.retry

PLAY RECAP *************************************************************************************************************************************************************

Any support much appreciated.