# Typecast variables are not preserved which is breaking some cloud providers

**URL:** <https://forum.ansible.com/t/typecast-variables-are-not-preserved-which-is-breaking-some-cloud-providers/19088>\
**Category:** Ansible Project\
**Created:** [August 22, 2015, 11:56pm UTC](https://forum.ansible.com/t/typecast-variables-are-not-preserved-which-is-breaking-some-cloud-providers/19088 "2015-08-22T23:56:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Heeney](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@Patrick\_Heeney](https://forum.ansible.com/u/Patrick_Heeney)\
**Post date:** [August 22, 2015, 11:56pm UTC](https://forum.ansible.com/t/typecast-variables-are-not-preserved-which-is-breaking-some-cloud-providers/19088/1 "2015-08-22T23:56:16Z")

</div>

I have a role like below, that typecasts item.payment to an int. However this appears to be converted back to a string. Ansible throws this error “msg: value of payment\_term must be one of: 1,12,24, got: 1” because it was not a valid int. At the moment this is breaking the linode module or any module that relies on an int with choices.

- name: setup linode  
linode:  
name: ‘{{ item.name }}’  
state: ‘{{ item.state | default(“present”) }}’  
payment\_term: ‘{{ item.payment | int | default(1) }}’  
api\_key: ‘{{ linode\_api\_key }}’  
with\_items: linode\_servers  
register: linode\_response

I think this may be related to [https://github.com/ansible/ansible/issues/5463](https://github.com/ansible/ansible/issues/5463)

It seems others are having the same issue with bools, but the ticket has not received any official response.

---

<div class="post-metadata">

**Author:** ![Patrick\_Heeney](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@Patrick\_Heeney](https://forum.ansible.com/u/Patrick_Heeney)\
**Post date:** [August 24, 2015, 6:34pm UTC](https://forum.ansible.com/t/typecast-variables-are-not-preserved-which-is-breaking-some-cloud-providers/19088/2 "2015-08-24T18:34:15Z")

</div>

I moved this to [https://github.com/ansible/ansible/issues/12071](https://github.com/ansible/ansible/issues/12071)
