This has to be easy, but I have tried a way to many things.  Given a hex 
number as a string, say '8d', I cannot convert it to a decimal string.
I presumed to prepend '0x' but '{{ "0x8d" | int }}' returns 0.  I am not 
having any better luck with jinja2 format().  I feel pretty stupid right 
now and I am tempted to just call the shell.
Sorry, but sometimes I really miss perl's weak type casting.

One of 100 attempts:

---
- hosts: localhost
  gather_facts: no
  tasks:
  - set_fact:
      hex_val: '0x8d'
  - set_fact:
      int_val: "{{ hex_val | int }}"
  - debug:
      var: int_val




-- 
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/3ea4b52d-42f8-4c56-90c5-fc7d3117f260%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to