I have a variable called 'oldid' set to a value of '0004fb0000060000b824b442d236a8b7'
I wish to manipulate it so that I do the following:
1. strip off the last 12 characters (slicing?)
2. Re-add 12 more characters that are a random numbers between 0-9
Here is what I have, but unsure if I can even do this (it is failing). Syntax is wrong, but is hopefully descriptive in nature. Wonder if my approach is wrong too?
tasks:
- name: Set new_id
set_fact:
new_id: "{{ oldid[:-12]{{ 9 | random }}"
I need to repeat the {{ 9 | random }} a total of 12 times.... don't know if there is a shortcut way to do that other than retyping the command over and over.