Hi,
I am currently trying to reboot the vsphere build in the post provisioner steps taken by ansible. I’ve tried several different was to do this including
- 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
and
- name: reboot
reboot:
This is what my packer’s build.json looks like:
"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`}}'" ]
}
],
However, I still continue to timeout even as I increase the timeout delay. Is there a better way to accomplish a reboot during the provisioning phase with packer? Thank you.