# Integer data type unable to retain his type when passed into a variable

**URL:** <https://forum.ansible.com/t/integer-data-type-unable-to-retain-his-type-when-passed-into-a-variable/39950>\
**Category:** Get Help\
**Tags:** ansible, playbook, netbox, ubuntu\
**Created:** [January 31, 2025, 9:23pm UTC](https://forum.ansible.com/t/integer-data-type-unable-to-retain-his-type-when-passed-into-a-variable/39950 "2025-01-31T21:23:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrys\_Bimokono](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chrys_bimokono/32/7425_2.png) [@chrys\_Bimokono](https://forum.ansible.com/u/chrys_Bimokono)\
**Post date:** [January 31, 2025, 9:23pm UTC](https://forum.ansible.com/t/integer-data-type-unable-to-retain-his-type-when-passed-into-a-variable/39950/1 "2025-01-31T21:23:31Z")

</div>

**I am not able to pass integer variable to task without losing the integer type**.  
I am trying to populate netbox using ansible playbook.  
ansible version: 2.17.7  
python version = 3.10.12  
jinja version = 3.1.5  
My structure looks like this:

 ![Screenshot 2025-01-31 160804](https://us1.discourse-cdn.com/ansible/original/2X/2/25eb81ab823f6e5f650f00850d8d7cca2a340c09.png)

Inside vars.yml i have:

```auto
vm_lists:

 - name: my-vm
    status: Active
    cluster: my-cluster
    platform: 5
    vcpus: 6
    memory: 24

 - name: my-vm
    status: Active
    cluster: my-cluster
    platform: 5
    vcpus: 6
    memory: 24

```

inside the tasks/add\_virtual\_machines.yml i have:

```auto
- name: "Add Virtual Machine to NetBox"
  netbox.netbox.netbox_virtual_machine:
    netbox_url: "{{ lookup('env', 'NETBOX_URL') }}"
    netbox_token: "{{ lookup('env', 'NETBOX_TOKEN') }}"
    validate_certs: false # Disable SSL verification
    data:
      name: "{{ vm.name }}"
      status: Active
      cluster: "{{ vm.cluster }}"
      platform: "{{ vm.platform }}"
      vcpus: "{{ vm.vcpus }}"
      memory: "{{ vm.memory}}"
    state: present
  loop: "{{ vm_lists }}"
  loop_control:
     loop_var: vm

```

When running the main.yml playbook i get this error:  
“ansible\_loop\_var”: “vm”, “changed”: false, “msg”: “Could not resolve id of platform: 5”.

I understand that due to jinja2 template, it is unable to pass on this integer data type, but instead it get converted to string.

i have tried:  
settings:

- jinja2\_native=True in ansible.cfg but it did not work.
- using the {{item.parameter | int}} also does not work.
