Hello,
I have a playbook that I'm working on to migrate VMs to a new ESX host. I
finally got 1 maybe 2 parts working where I can power-off the machine and
power-on again. Here's where the maybe comes into play.
When I run the playbook I can see the VM power-off and immediately power-on
again, but let's say if I were to cut out the power-on task and put it back
in there it can't detect the VM.
I thought something like this would happen because how can ansible
re-connect to a powered down host? By the way this is my first time using a
tool like ansible and most of this playbook wasn't running at all... lot's
of errors and mistakes. Haha
---
- name: Virtual Machine Migration Playbook
hosts: vmserver
vars:
VMWARE_PASSWORD: credentials
VMWARE_USER: credentials
VMWARE_HOST: credentials
VMWARE_VCENTER: credentials
remote_user: root
gather_facts: true
tasks:
- name: Test connectivity
ping:
- name: Wait for the virtual machine to shutdown
vmware_guest_powerstate:
hostname: "{{ VMWARE_VCENTER }}"
user: "{{ VMWARE_USER }}"
password: "{{ VMWARE_PASSWORD }}"
name: "{{ VMWARE_HOST }}"
state: powered-off
state_change_timeout: 200
validate_certs: no
delegate_to: localhost
register: deploy
- name: Wait for the virtual machine to poweron
vmware_guest_powerstate:
hostname: "{{ VMWARE_VCENTER }}"
user: "{{ VMWARE_USER }}"
password: "{{ VMWARE_PASSWORD }}"
name: "{{ VMWARE_HOST }}"
state: powered-on
state_change_timeout: 200
validate_certs: no
delegate_to: localhost
register: deploy
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/905f6b97-2efe-4583-9a12-e07ee35a5c5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.