To get the base64 string I uploaded the image with the Ansible-Tower GUI and call the API GET method. An alternative is to use this website: https://www.base64-image.de/
My goal is to encode the image with ansible or with a jinja2 filter like this:
its not an Ansible Tower question. Is general Ansible.
I'm sorry, probably read it to fast and jumped to conclusions.
I want to encode a jpg image to base64 to use this image in a JSON object.
This JSON object I want to transfer as body with the Ansible module uri.
The b64decode in Ansible can only handle plain text/ascii, for binary date it gives corrupt result so my hunch that b64encode does the same and you need to use base64 command with command/shell module.