I want convert an integer variable into a specific string format.
This integer (for example: 56
, 71
, 80
) needs to be converted into a string formatted first_digit.second_digit
(for example 5.6
, 7.1
).
How can I do this?
I tried a mixture of Python and Jinja but it doesn't work.
With:
- name: Install PHP > 5.6
apt:
name:
- "php{{ str(php) | php[0]+'.'+php[1] }}"
when: php > 56
I get this error:
template error while templating string: expected token 'end of print statement', got '['. String: php{{ str(php) | php[0]+'.'+php[1] }}