Vagrant - SSH 响应非零退出状态

Vagrant - SSH responded non-zero exit status

==> payment: Notice: /Stage[main]/Nginx::Service/Service[nginx]/ensure: ensure changed 'stopped' to 'running'
==> payment: Info: /Stage[main]/Nginx::Service/Service[nginx]: Unscheduling refresh on Service[nginx]
==> payment: Info: Stage[main]: Unscheduling all events on Stage[main]
==> payment: Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
==> payment: Notice: Applied catalog in 219.19 seconds
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

我无法根据上述内容找出实际失败的原因? Nginx 符合预期 运行。

在你的情况下没有失败。当 Puppet 成功应用导致系统更改的目录时,returned 的退出代码是 2。 Vagrant 将所有不是 0 的 ssh 退出代码解释为意外和隐含的失败。在此实例中,Puppet return为退出代码输入了 2,而 Vagrant 将其解释为失败。

我建议在执行 echo $? 和 shell 的 Puppet 执行后添加一个配置行。这将为 Vagrant 提供所需的 0 return 代码,同时还允许您查看实际代码并验证它是 2.

config.vm.provision 'shell', inline: 'echo $?'

根据需要将 config 替换为本地 Ruby 块变量。

https://docs.puppet.com/puppet/latest/man/agent.html#OPTIONS