I thought one of the big improvements in 2.x was not blindly casting nested
values to strings:
vars:
a_var_number: 200
tasks:
- mymodule:
module_args:
a_fixed_number: 100
a_var_number: "{{ a_number }}"
a_var_number_with_cast: "{{ a_number | int }}"
Inside the module module_args dict gets:
module = AnsibleModule(
argument_spec=dict(
module_args=dict(required=True, type='raw')
),
)
args = module.params['module_args']
is_num_1 = isinstance(args['a_fixed_number'], int) # True
is_num_2 = isinstance(args['a_var_number'], int) # False
is_num_3 = isinstance(args['a_var_number_with_cast'], int) # False
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ab0c1187-6552-4e02-ba43-2338d23ab889%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.