Hi;

I'm trying to automate the addition of disk devices to VM guests.  After a 
bit of work and lots of lessons learned, I've gotten to this point:

  - name: add disk space
    vmware_guest_disk:
      hostname: "{{s}}"
      username: "{{vu}}"
      password: "{{vp}}"
      datacenter: "{{dc}}"
      validate_certs: no
      name: "{{inventory_hostname}}"
      disk:
        - size_gb: 20
          type: thick
          datastore: "{{dsi.datastores[0].datastore_cluster}}"
          scsi_controller: 0
          state: present
    delegate_to: localhost
    when:
      - dsi.datastores[0].datastore_cluster|length > 0
      - dsi.datastores[0].freeSpace / dsi.datastores[0].capacity * 100 > 20

This results in:

TASK [add disk space] 
***************************************************************************************************
fatal: [cl1vinfspt1000 -> localhost]: FAILED! => {"changed": false, "msg": 
"Please 
specify 'unit_number' under disk parameter
at index [0], which is required while creating disk."}

The number of disks on the vms which need disk additions is going to vary - 
in fact, some may even have multiple controllers.  I've used govc to add 
disks to vms and it just tacks the disk on the end of the bus. 

So, two questions:


   - Is there a way to tell vmware_guest_disk to use the next available 
   unit number?
   - Failing that, is there a clever way to identify the next available 
   scsi unit number?  I'm even willing to use OS commands and create a 
   variable... interesting thought, that.  I'll look there next.


Thanks for any hints/tips/suggestions.

Doug O'Leary


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a04b73d3-c17c-4cf8-a632-8b610d171cf8%40googlegroups.com.

Reply via email to