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