Skip to content

Warning about variable with reserved name: name #273

@denngie

Description

@denngie
SUMMARY

Hi, I am getting warning messages about the variable name being used and that it is a reserved name.

If I change the properties to not include name, configure hostnames to use config.name and comment out these lines the warning disappears

if "name" not in properties_param:
properties_param.append("name")

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vms

ANSIBLE VERSION
ansible [core 2.17.14]
  config file = /home/dennis/my-ansible-stuff/ansible.cfg
  configured module search path = ['/home/dennis/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/dennis/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/dennis/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/dennis/.local/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /home/dennis/.ansible/collections/ansible_collections
Collection    Version
------------- -------
vmware.vmware 2.4.0

# /home/dennis/.local/lib/python3.10/site-packages/ansible_collections
Collection    Version
------------- -------
vmware.vmware 1.7.1
CONFIGURATION
CALLBACKS_ENABLED(/home/dennis/my-ansible-stuff/ansible.cfg) = ['profile_tasks']
CONFIG_FILE() = /home/dennis/my-ansible-stuff/ansible.cfg
DEFAULT_FORKS(/home/dennis/my-ansible-stuff/ansible.cfg) = 16
DEFAULT_HOST_LIST(/home/dennis/my-ansible-stuff/ansible.cfg) = ['/home/dennis/.ansible/inventory']
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/dennis/my-ansible-stuff/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/home/dennis/my-ansible-stuff/ansible.cfg) = yaml
DISPLAY_SKIPPED_HOSTS(/home/dennis/my-ansible-stuff/ansible.cfg) = False
HOST_KEY_CHECKING(/home/dennis/my-ansible-stuff/ansible.cfg) = False
INTERPRETER_PYTHON(/home/dennis/my-ansible-stuff/ansible.cfg) = auto_silent
RETRY_FILES_ENABLED(/home/dennis/my-ansible-stuff/ansible.cfg) = False
OS / ENVIRONMENT

WSL Ubuntu 22.04

STEPS TO REPRODUCE

Use the simple config example from vmware.vmware.vms but with properties modified to exclude name and change hostname to config.name and do ansible -m debug -a var=name Photon

plugin: vmware.vmware.vms
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: false
properties: ["config.cpuHotAddEnabled", "config.cpuHotRemoveEnabled", "config.instanceUuid", "config.hardware.numCPU", "config.name", "config.template", "config.uuid", "guest.hostName", "guest.ipAddress", "guest.guestId", "guest.guestState", "runtime.maxMemoryUsage", "customValue", "summary.runtime.powerState", "config.guestId"]
hostnames:
  - config.name
EXPECTED RESULTS
ansible -m debug -a var=name Photon

PLAY [Ansible Ad-Hoc] **************************************************************************************************
Friday 31 October 2025  19:16:38 +0100 (0:00:00.020)       0:00:00.020 ********

TASK [debug] ***********************************************************************************************************
ok: [Photon] =>
  name: VARIABLE IS NOT DEFINED!

PLAY RECAP *************************************************************************************************************
Photon                     : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Friday 31 October 2025  19:16:38 +0100 (0:00:00.031)       0:00:00.051 ********
===============================================================================
debug ----------------------------------------------------------------------------------------------------------- 0.03s
ACTUAL RESULTS
dennis@Dennis-PC:~/my-ansible-stuff$ ansible -m debug -a var=name Photon

PLAY [Ansible Ad-Hoc] **************************************************************************************************
[WARNING]: Found variable using reserved name: name
Friday 31 October 2025  19:15:46 +0100 (0:00:00.017)       0:00:00.017 ********

TASK [debug] ***********************************************************************************************************
ok: [Photon] =>
  name: Photon

PLAY RECAP *************************************************************************************************************
Photon                     : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Friday 31 October 2025  19:15:46 +0100 (0:00:00.031)       0:00:00.049 ********
===============================================================================
debug ----------------------------------------------------------------------------------------------------------- 0.03s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions