Hi
Somewhere halfway through one of our playbooks there is a ‘pause’ task that prompts for input:
- name: Database restoration - timestamp selection
pause:
prompt: |
Select the number of a backup date to restore from:
{% for ts in backup_timestamps_available %}
{{ (loop.index|string).ljust(8) ~ ‘%Y-%m-%d (%A) %H:%M:%S’ | strftime(ts) }}
{% endfor %}
echo: true
register: ts_select
when: db_restore
But in some scenarios this playbook is being run from a shell wrapper, which can be non-interactive, in which case this step will bail with:
[WARNING]: Not waiting for response to prompt as stdin is not interactive
I’d like to gracefully stop right at the beginning when db_restore is set but the play is not run interactively.
I can check in the shell wrapper, but that doens’t know about ansible extra vars.
Is there a way to check in the playbook for interactiveness?
thx