如何解决使用 Packer 和 ansible 配置器重新启动 vsphere 实例 - 超时
我目前正在尝试在 ansible 采取的后置备步骤中重新启动 vsphere 构建。我尝试了几种不同的方法来做到这一点,包括
- name: Reboot the server
shell: "sleep 5 && reboot"
async: 1
poll: 0
- name: Wait for the reboot and reconnect
wait_for:
port: 22
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
search_regex: OpenSSH
delay: 10
timeout: 60
和
- name: reboot
reboot:
这是我的打包程序的 build.json 的样子:
"provisioners": [
{
"type": "ansible","playbook_file": "../ansible/deploy-kvm.yml","use_proxy": false,"extra_arguments": [ "-vv","--extra-vars","XXXdefault_password_hash='{{user `default_password_hash`}}' ansible_become_pass='{{ user `ansible_become_pass`}}'" ]
}
]
然而,即使我增加了超时延迟,我仍然继续超时。在使用 packer 的配置阶段,是否有更好的方法来完成重启?谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。