Open
Description
SUMMARY
community.vmware.vmware_guest_disk is not idempotent for windows systems
while it is for linux
ISSUE TYPE
- Bug Report
COMPONENT NAME
community.vmware.vmware_guest_disk
ANSIBLE VERSION
ansible [core 2.11.6]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/[email protected]/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible
ansible collection location = /usr/share/ansible/plugins/collections:/home/[email protected]/ansible/plugins/collections
executable location = /usr/local/bin/ansible
python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
jinja version = 3.0.2
libyaml = True
COLLECTION VERSION
Collection Version
---------------- -------
community.vmware 1.15.0
CONFIGURATION
ANSIBLE_PIPELINING(/etc/ansible/ansible.cfg) = True
COLLECTIONS_PATHS(/etc/ansible/ansible.cfg) = ['/usr/share/ansible/plugins/collections', '/home/[email protected]/ansible/plugins/coll
DEFAULT_ACTION_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/usr/local/lib/python3.7/dist-packages/ara/plugins/action']
DEFAULT_CALLBACK_PLUGIN_PATH(env: ANSIBLE_CALLBACK_PLUGINS) = ['/usr/local/lib/python3.7/dist-packages/ara/plugins/callback']
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/home/[email protected]/ansible/env/defaults/inventories', '/home/[email protected]
DEFAULT_LOOKUP_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/usr/local/lib/python3.7/dist-packages/ara/plugins/lookup']
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['/usr/share/ansible/plugins/roles', '/home/[email protected]/ansible/roles']
DEFAULT_VAULT_PASSWORD_FILE(/etc/ansible/ansible.cfg) = /home/[email protected]/.vault_pass
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = auto
INVENTORY_ANY_UNPARSED_IS_FAILED(/etc/ansible/ansible.cfg) = True
INVENTORY_ENABLED(/etc/ansible/ansible.cfg) = ['host_list', 'script', 'yaml', 'ini', 'community.vmware.vmware_vm_inventory', 'constructed']
OS / ENVIRONMENT
Debian10
CentOS8
Windows Server2019
STEPS TO REPRODUCE
run the following task against different OS on vCenter Managed vSphere Infra
- name: vsphere | ensure os/data disk size
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
datacenter: "{{ vDataCenter.Name }}"
name: "{{ inventory_hostname }}"
disk:
- size_gb: 50
state: present
scsi_controller: 0
unit_number: 0
delegate_to: localhost
EXPECTED RESULTS
if the os disk on scsi 0:0 is already 50 GB result ok, if greater extend, if smaller fail
ACTUAL RESULTS
when the host is a Debian10 or CentOS8 then it works as expected
when the host is a Windows2019 Server it fails with the following error message
failed: [testserver333 -> localhost] (item={'Name': 'Windows2019', 'OsPath': 'C:\\', 'ScsiPath': '0:0', 'Path': 'C:\\', 'Size': 50.0, 'ByteSizeUnit': 'GB', 'Action': 'None', 'Description': 'Hard disk 1, Thin: True', 'Id': 'cf81c031-bccf-47b3-ae54-ad8c6beb6f45', 'Status': 'Ready'}) => {
"_data_disk": {
"Action": "None",
"ByteSizeUnit": "GB",
"Description": "Hard disk 1, Thin: True",
"Id": "cf81c031-bccf-47b3-ae54-ad8c6beb6f45",
"Name": "Windows2019",
"OsPath": "C:\\",
"Path": "C:\\",
"ScsiPath": "0:0",
"Size": 50.0,
"Status": "Ready"
},
"ansible_loop_var": "_data_disk",
"changed": false,
"invocation": {
"module_args": {
"datacenter": "DC_ctRZ01",
"disk": [
{
"autoselect_datastore": null,
"compatibility_mode": null,
"controller_number": null,
"controller_type": null,
"datastore": null,
"destroy": true,
"disk_mode": null,
"filename": null,
"iolimit": null,
"rdm_path": null,
"scsi_controller": 0,
"scsi_type": null,
"shares": null,
"sharing": false,
"size": null,
"size_gb": 50,
"size_kb": null,
"size_mb": null,
"size_tb": null,
"state": "present",
"type": null,
"unit_number": 0
}
],
"folder": null,
"hostname": "vce01-002",
"moid": null,
"name": "testserver333",
"uuid": null,
}
},
"msg": "Failed to manage disks for virtual machine 'testserver333' with exception : (\"Parameters for device 'scsi0' may not be modified while the virtual machine is powered on.\", None)"