When in state poweredoff or poweredon, vmware_guest can't find my vm,
therefore it assumes I want to create a new VM.
When in state present, it has no problem finding it.
Consider the playbook:
- name: Modify existing VM's networking, memory and CPU
> hosts: modify
> gather_facts: False
> connection: local
> vars_files:
> - group_vars/vault/lab_credentials.yml
> tasks:
> - name: Power Off the VM
> vmware_guest:
> validate_certs: False
> datacenter: "{{ vcenter_datacenter }}"
> hostname: "{{ vcenter_hostname }}"
> username: "{{ vcenter_user }}"
> password: "{{ vcenter_passwd }}"
> guest_id: "{{ vmware_guest_id }}"
> name: "{{ guest_name }}"
> state: poweredoff
> - name: Modify the VM Specs
> vmware_guest:
> validate_certs: False
> datacenter: "{{ vcenter_datacenter }}"
> hostname: "{{ vcenter_hostname }}"
> username: "{{ vcenter_user }}"
> password: "{{ vcenter_passwd }}"
> name: "{{ guest_name }}"
> folder: "{{ guest_folder }}"
> hardware:
> memory_mb: "{{ guest_memory }}"
> num_cpus: "{{ guest_cpus }}"
> networks:
> - name: "{{ guest_network }}"
> device_type: "{{ guest_nic }}"
> ip: "{{ guest_ipaddr }}"
> netmask: "{{ guest_netmask }}"
> gateway: "{{ guest_gateway }}"
> customization:
> domain: "{{ guest_domain }}"
> dns_servers: "{{ guest_dns_servers }}"
> dns_suffix: "{{ guest_dns_suffix }}"
> state: present
> - name: Turn on the VM
> vmware_guest:
> validate_certs: False
> datacenter: "{{ vcenter_datacenter }}"
> hostname: "{{ vcenter_hostname }}"
> username: "{{ vcenter_user }}"
> password: "{{ vcenter_passwd }}"
> guest_id: "{{ vmware_guest_id }}"
> name: "{{ guest_name }}"
> state: poweredon
If I power off my VM by hand, and only run the task Modify the VM Specs,
then the task runs fine, vmware_guest has no problems finding my VM,
using the variable "{{ guest_name }}".
But if I run the tasks Power Off the VM or Turn on the VM, vmware_guest
cannot find the VM, thus assumes I want to create a new one.
Is this a bug, or am I doing something wrong?
Thanks
--
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/d29c337b-ba5c-40f7-9e1a-69439fa67f33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.