Discussion:
[ansible-project] yaml structures passed to roles that to_json cannot use integers
Barry Kaplan
2015-06-01 16:30:54 UTC
Permalink
I just got hit with https://github.com/ansible/ansible/issues/9362, where
in the following 'instances' is a string when the role uses to_json to pass
the data to marathon:

vars:
vi_instances: "{{instances | default(2)}}"



roles:
- role: marathon_app
marathon_app:
id: /svc/auth
cpus: 0.5
mem: 64.0
instances: "{{vi_instances | int}}"


Does anybody know a workaround to this?
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e9aaf88d-5f4e-4094-9c8d-359f2c814e50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Barry Kaplan
2015-06-22 05:58:43 UTC
Permalink
I'm still hitting a wall on this. Any ideas anybody?
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d3661c4c-1e5b-43c0-859c-b8b8ab388fad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-06-26 03:39:44 UTC
Permalink
A fix for this was merged to current devel, I'm not sure we can
backport it to older versions as the templating code involved was very
convoluted (much simpler in new version).
--
Brian Coca
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8mVe3%2B0_77-XaF4fy8rn6_aXMcOJk6Ore4%2BRZbodj58gA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
David Birdsong
2015-07-10 01:40:54 UTC
Permalink
Post by Brian Coca
A fix for this was merged to current devel, I'm not sure we can
backport it to older versions as the templating code involved was very
convoluted (much simpler in new version).
any news on this front?

i'm trying to share data directly between ansible and consul by inheriting
data from upper level variables files and i can't get integers to render to
json as integers.
Post by Brian Coca
--
Brian Coca
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/158b981b-5bdc-4b90-8c55-1cda58b5bd98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Barry Kaplan
2015-07-11 02:24:55 UTC
Permalink
I have to say this is in my top 5 biggest ansible yak shavings. So many
times I just need to pass configuration directly to a role which would
to_json or to_yaml it. But I cannot because of this bug. Hence I need to
parse out every little variable all the way down the structure ensuring
that ints or floats get converted.

Something that would be simple and elegant turns into a turd.
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/37fedd43-3850-450d-8720-0c8fe1356db2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-07-11 02:27:48 UTC
Permalink
Sorry to hear,

We hope to release next month, hopefully that will fix this issue.
Variable handling was one major headache of the old codebase, part of
the reason we rewrote the core.
--
Brian Coca
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8m%2BgqXwNN2qrEBX8mSAKGus%3DfZevMMZFBP%2BPoswKXj0KQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...