Typecast variables are not preserved which is breaking some cloud providers

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

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

I moved this to https://github.com/ansible/ansible/issues/12071