2

我在 Ansible 中使用 Vagrant 提供命令。当它到达 playbook 中的暂停操作时,它会导致错误。

这是剧本中的内容:

- 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
4

1 回答 1

1

这是由于 Vagrant 运行 Ansible 剧本的方式。该剧本完整运行,然后将输出呈现给用户。您可以通过将阻塞暂停替换为以下内容来确认发生这种情况:

action: pause seconds=10

Ansible 将运行显示“[default] Running provisioner: ansible ...”的剧本,直到 10 秒结束(剧本的其余部分已完成)。

于 2013-09-21T13:51:26.097 回答