Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: vmware.vmware_rest.vcenter_vm support power_on for created VMs #408

Open
Tronde opened this issue Apr 12, 2023 · 1 comment
Open

RFE: vmware.vmware_rest.vcenter_vm support power_on for created VMs #408

Tronde opened this issue Apr 12, 2023 · 1 comment
Labels
blocked Used when issue is blocked by so other issue waiting_on_contributor Needs help. Feel free to engage to get things unblocked

Comments

@Tronde
Copy link

Tronde commented Apr 12, 2023

SUMMARY

The docs at [0] describe the parameter power_on to "Attempt to perform a {@link #powerOn} after clone."

I guess this parameter only works when state: clone, because it doesn't work when state: present. I would like to have this module support the parameter for state: present as well to be able to power on newly created VMs without using an additional task.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vcenter_vm.py

ADDITIONAL INFORMATION

The feature would be use to create and power on the created VM in one task. So it would be ease to use a dict with multiple VMs to have them created and powered on without using the vcenter_vm_power module on each VM afterwards.

---
- name: Gather vSphere information and create VM
  hosts: localhost
  vars_files:
    - my.vault
  debugger: on_failed

  tasks:
    - name: Create a VM
      vmware.vmware_rest.vcenter_vm:
        vcenter_hostname: "{{ vmware_host }}"
        vcenter_username: "{{ vmware_user }}"
        vcenter_password: "{{ vmware_pass }}"
        vcenter_validate_certs: false
        placement:
          cluster: "{{ resource_pool_info.id }}"
          datastore: "{{ my_datastore.datastore }}"
          folder: "{{ my_vm_folder.folder }}"
          resource_pool: "{{ resource_pool_info.value.resource_pool }}"
        name: VM1
        guest_OS: RHEL_8_64
        hardware_version: VMX_19
        boot:
          type: BIOS
        cdroms:
        - allow_guest_control: true
          backing:
            type: "ISO_FILE"
            iso_file: "{{ MY_ISO_PATH }}"
          label: "CD/DVD drive 1"
          start_connected: true
        cpu:
          count: 2
        memory:
          hot_add_enabled: true
          size_MiB: 2048
        disks:
        - type: SCSI
          new_vmdk:
            name: vm1
            capacity: 2000000
            storage_policy: 
              policy: "{{ MY_POLICY }}"
        nics:
        - start_connected: true
          type: VMXNET3
          mac_type: GENERATED
          backing:
              type: STANDARD_PORTGROUP
              network: "{{ my_network.network }}"
        state: present
        power_on: true
      register: _result

But in _result if found "power_state": "POWERED_OFF", afterwards.

[0] https://docs.ansible.com/ansible/latest/collections/vmware/vmware_rest/vcenter_vm_module.html#parameters

In case you need additional information to understand the use case, please, don't hesitate to ask and I try to explain it in more detail.

@jillr jillr added waiting_on_contributor Needs help. Feel free to engage to get things unblocked and removed needs_triage labels Apr 18, 2023
@machacekondra
Copy link

Unfortunatelly vmware.vmware_rest modules are automatically generated. If the VMware REST API won't add support for such an attribute, we won't be adding such a feature. In future, we will be supporting SOAP version of the VMware VM module, so I would suggest to use that one, if one task is needed.

@machacekondra machacekondra added the blocked Used when issue is blocked by so other issue label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Used when issue is blocked by so other issue waiting_on_contributor Needs help. Feel free to engage to get things unblocked
Projects
None yet
Development

No branches or pull requests

4 participants