ansible-collections / community.vmware

Ansible Collection for VMware
GNU General Public License v3.0
342 stars 336 forks source link

vmware_host_datastore: Increase capacity by adding multiple vmfs_device_name #1018

Open tzago opened 2 years ago

tzago commented 2 years ago
SUMMARY

Currently, I can't see an option to increase the datastore capacity by adding multiples vmfs iscsi lun disks to the same DATASTORE.

ISSUE TYPE
COMPONENT NAME

vmware_host_datastore

ADDITIONAL INFORMATION

Create extend/increase datastore capacity

Increase Datastore Capacity by allowing to add additional vmfs iscsi lun's identifiers from the selected host.

state: description:

This parameter, to my understanding only accepts one VMS device name identifier at a time.

The challenge I have for my project is I need a way to pass a list of vmfs_device_name's to be mounted on my datastore

Something like accepting a list of vmfs lun disks

"vmfs_device_name: [ vmfs_lun1, vmfs_lun2, vmfs_lun3 ...]"

Or even better allowing to add additional vmfs luns by means of accepting iterations through a loop similar approach used by datastore_type: nfs that is already implemented.

- name: Mount VMFS datastores to ESXi                                          
  community.vmware.vmware_host_datastore:                                      
      hostname: '{{ vcenter_hostname }}'                                       
      username: '{{ vcenter_username }}'                                       
      password: '{{ vcenter_password }}'                                               
      validate_certs: no                                                       
      datastore_name: '{{ datastore_name }}'                                   
      datastore_type: '{{ datastore_type }}'                                   
      vmfs_device_name: "['naa.6001405dbeb8b035aa540b4b6d005fdf', 'naa.60014056de5b9c976b64f08bb679bbf2']" 
      vmfs_version: 6                                                          
      esxi_hostname: '{{ esxi_hostname }}'                                     
      state: present                                                           
  delegate_to: localhost                                                       
  register: results 

or something like looping through the lun disk identifiers and that would be the same approach we have for datastore_type: nfs that is already implemented.

- name: Mount VMFS datastores to ESXi                                          
  community.vmware.vmware_host_datastore:                                      
      hostname: '{{ vcenter_hostname }}'                                       
      username: '{{ vcenter_username }}'                                       
      password: '{{ vcenter_password }}'                                               
      validate_certs: no                                                       
      datastore_name: '{{ datastore_name }}'                                   
      datastore_type: '{{ item.type }}'                                   
      vmfs_device_name: '{{ item.identifier }}'
      vmfs_version: 6                                                          
      esxi_hostname: '{{ item.esxi }}'                                     
      state: present                                                           
  delegate_to: localhost                                                       
  register: results 
  loop:                                                                        
     - { 'identifier': 'naa.6001405dbeb8b035aa540b4b6d005fdf', 'esxi': '10.0.0.200', 'type': 'vmfs'} 
     - { 'identifier': 'naa.6001405a7e4fde4849e4b46a903ec362', 'esxi': '10.0.0.200', 'type': 'vmfs'} 
     - { 'identifier': 'naa.60014056de5b9c976b64f08bb679bbf2', 'esxi': '10.0.0.200', 'type': 'vmfs'} 
     - { 'identifier': 'naa.600140585e8dd286535437f9ff072c66', 'esxi': '10.0.0.200', 'type': 'vmfs'} 

We have a ticket that addresses the second challenge I have that comes after this one described above.

tzago commented 2 years ago

The ticket I mentioned above is https://github.com/ansible-collections/community.vmware/issues/910