AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Expand a Virtual Disk in VMware vSphere Virtual Machine - Ansible module vmware_guest_disk — Video Tutorial

How to automate the expansion from 1GB to 2GB size Virtual Disk connected to VMware Virtual Machine guest named “myvm” using Ansible Playbook and vmware_guest_disk module.

Watch Video

Watch "Expand a Virtual Disk in VMware vSphere Virtual Machine - Ansible module vmware_guest_disk" on YouTube

What You'll Learn

Full Tutorial Content

How to Expand a Virtual Disk in VMware vSphere Virtual Machine with Ansible? I'm going to show you a live Playbook and some simple Ansible code. I'm Luca Berton and welcome to today's episode of Ansible Pilot. Ansible Expand a Virtual Disk in VMware vSphere Virtual Machine - `community.vmware.vmware_guest_disk` - Manage disks related to a virtual machine in a given vCenter infrastructure Let's talk about the Ansible module `vmware_guest_disk`. The full name is `community.vmware.vmware_guest_disk`, which means that is part of the collection of modules to interact with VMware, community-supported. It manages disks related to a virtual machine in a given vCenter infrastructure. Parameters - hostname string / username string / password string / datacenter string / validate_certs boolean - connection details - datacenter string - The datacenter name to which the virtual machine belongs to - scsi_controller / unit_number / scsi_type string - SCSI controller details - size / size_kb / size_mb / size_gb / size_tb string - Disk storage size - disk_mode string - persistent / independent_persistent / independent_nonpersistent The following parameters are useful in order to Expand a Virtual Disk in VMware vSphere Virtual Machine using the module `vmware_guest_disk`. First of all, we need to establish the connection with VMware vSphere or VMware vCenter using a plethora self-explicative parameters: `hostname`, `username`, `password`, `datacenter`, and `validate_certs`. Once the connection is successfully established you could specify the desired disk configuration, in this expansion, a disk is connected to a virtual machine. The mandatory parameters are only `datacenter` and `unit_number`. The `datacenter` parameter specifies which datacenter name the virtual machine belongs to, for resources allocations. The disk must be connected to a SCSI controller inside the virtual machine, so you should specify all the small details like `scsi_controller`, `unit_number`, and `scsi_type`. You might be interested in deep-diving into some performance analysis to properly adjust these parameters. You could specify the disk size via various parameters according to the needed size unit: kb, MB, GB, TB, etc. One most important parameter is the `disk_mode`, default to `persistent` mode, other options are `independent_persistent` and `independent_nonpersistent`. Links - [`community.vmware.vmware_guest_disk`](https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_guest_disk_module.html) ## Playbook How to Expand a Virtual Disk in VMware vSphere Virtual Machine with Ansible. I'm going to show you how to expand the size of an additional disk connected to a Virtual Machine named "myvm" using Ansible Playbook. The disk is connected to a SCSI controller number 1 and has unit number 1. The beginning of the Playbook has a size of 1 GB and we would like to expand it to 2 GB. code - vm_disk_expand.yml ```yaml --- - name: vm disk Playbook hosts: loc

About This Tutorial

Read the full written article: Expand a Virtual Disk in VMware vSphere Virtual Machine - Ansible module vmware_guest_disk

Topics Covered

Related Video Tutorials