[vsphere_guest] add a new vmdk disk with an automatic number
36 views
Skip to first unread message
Vincent Burgun
unread,
Feb 27, 2017, 12:48:07 PM2/27/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi, We use ansible 2.1.0.0 for create VM on vmware vSphere 6.0.
Sometimes we need to add a disk We use a role "srv_disk" - name: "Configure extra disk" delegate_to: localhost ignore_errors: yes vsphere_guest: vcenter_hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" guest: "{{ inventory_hostname }}" vm_disk: disk1: disk2: size_gb: "{{ disk_size_gb }}" type: thick datastore: "{{ datastore.stdout }}" state: reconfigured
The problem is that we are forced to add a disk number. This is problematic when we have to recall the role to create a third disk.
Is it possible to use a variable to indicate the number of the disk? The ideal solution would be to be able to detect the number of discs on the VM and to automatically increment the number of the disc to be added.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi Vincent,
Did you ever find a solution? I have very much the same requirement, adding disks to cloud instances. In my case it would be more of a case of incrementing the device name eg /dev/sda , /dev/sdb , /dev/sdc , etc.