我正在使用Ansible的Vagrant配置命令。当它在剧本中进行暂停动作时会导致错误。
这就是剧本中的内容:
- name: Wait for user to copy SSH public key
action: pause prompt="Plase add the SSH public key above to your GitHub account"
这是错误:
fatal: [default] => Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 382, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 471, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 654, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/action_plugins/pause.py", line 103, in run
tcflush(sys.stdin, TCIFLUSH)
error: (25, 'Inappropriate ioctl for device')
FATAL: all hosts have already failed -- aborting
答案 0 :(得分:1)
这是由于Vagrant运行Ansible剧本的方式。该剧本以完整的方式运行,然后将输出呈现给用户。您可以通过以下方式替换阻止暂停来确认这种情况:
action: pause seconds=10
Ansible将播放显示“[default] Running provisioner:ansible ...”的剧本,直到10秒结束时才会播放(剧本的其余部分已经完成)。