That didn’t work for me because I am using an older version of ansible, and I think what you described is for version 2.1+
However your suggestion made me realize that my understanding of how the expect module works was fundamentally wrong to begin with. I now figured out what I needed to do. In my case I’m doing an unattended (silent) upgrade of confluence, and I am using:
expect:
command: /tmp/atlassian-confluence-5.10.0-x64.bin
responses:
“This will install Confluence”: o
“Upgrade an existing Confluence installation”: ‘3’
“Existing installation directory”: /opt/atlassian/confluence
“Back up Confluence home”: n
“List of modifications made within Confluence directories.”: ’ ’
“Do you want to proceed”: u
timeout: 300
I now realize that “responses” operates a bit like a case statement, whereas I thought it was working as a dumb sequence of inputs.