Switching to interactive mode in a task

Hi,

is it possible to run a task in a ‘normal’ ssh interaction mode? Sometimes I would have a playbook where, after having prepared a number of systems, there may be one command requiring some extra user input. This may be because this command is only sloppily programmed and for some reason may wait for stdin on some systems but not all of them (in which cases ansible will simply halt without any hint on why it might have stopped), or because the command is too powerful to mess around with expect in a try-and-err fashion, or simply because some extra configuration file must be adapted through opening vim.

Naturally, the concurrency for this task would have to be set to one, so I’m thinking about something like the following

tasks:

  • name: prepare system
    action: command do-some-command

  • name: fix configuration
    action: command /usr/bin/vim /etc/config.conf
    concurrency: interactive

  • name: restart service
    action: service name=some-service state=restarted

The second task would then run one after another and share full stdout and stdin with the terminal where the playbook is run, waiting for user input.

Is it possible that something like this may be added to ansible some day or – even better – is it already possible to accomplish this in some way? I could not find any information on this in the documentation, so sorry if ideas like this have already come up many times.

Cheers
/rike

Nope, you can’t do this.

However you can feed in input with < and the shell task, or use expect in such situations. Force < /dev/null if you like like with the shell task
if you have a command that you think may prompt, or see if it has a batch flag of some kind.

Ansible is really designed for non-interative management of a very large number of systems, so interactivity is something you want to fix up.

–Michael

Nope, you can’t do this.

However you can feed in input with < and the shell task, or use expect in such situations. Force < /dev/null if you like like with the shell task
if you have a command that you think may prompt, or see if it has a batch flag of some kind.

Ansible is really designed for non-interative management of a very large number of systems, so interactivity is something you want to fix up.

Sure, I wouldn’t want to do this for more than a few systems but ok. Guess, I’ll have to adapt our legacy scripts then. (This is probaly going to pay off anyway in the mid run, so it’s not too bad.)
Thanks
/rike