2

I'm aware that a command such as something -y will force a yes answer on any response back from the terminal, but I'm having problems with getting Ansible to automate the process of configuration. The module in question has defaults (a [no]) and the provisioning process hangs as I can't configure it to automatically select default answers.

Is there a way to run a command have the terminal automatically select defaults, as you can do with the -y flag?

2 Answers2

2

If you're looking to interact via a script with a program that doesn't allow you to select the correct options via command-line switches or an answers file for non-interactive operation, but only supports user interaction, you may want to take a look at expect

If you only need to answer a single question, then yes or yes <answer> is your friend.

HBruijn
  • 84,206
  • 24
  • 145
  • 224
0

You can probably do this with a little creative crafting of the yes command.

yes | script.sh or yes | command or if you wanted a "n", try yes n | command

ewwhite
  • 201,205