expect

Collection: builtin

Full Name: parallax.builtin.expect

Aliases: ansible.builtin.expect, expect

Synopsis

Run a command and answer its interactive prompts

Parameters

NameTypeRequiredDefaultDescription
commandstringyesThe command module takes command to run
responsesmapyesMapping of expected string/regex and string to respond with
timeoutint30Amount of time in seconds to wait for the expected strings
createsstringA filename, when it already exists, this step will not be run
removesstringA filename, when it does not exist, this step will not be run
chdirstringChange directory before running command
echoboolfalseWhether or not to echo out your response strings

Example

- name: Drive an interactive installer
  expect:
    command: /opt/vendor/install.sh
    responses:
      "Accept licence": "yes"
      "Install path": /opt/vendor
    timeout: 300