How to convert and save raw data to PDF format using ansible

I will be getting some raw data directly from an API. I want to format this and convert into PDF file and save it. I gone through ansible modules. I am not getting any idea in this. Can someone suggest how we can achieve it using Ansible please.


Solution 1:

When I asume you want to use Ansible to create the PDF from scratch you have several options:

The best one - you create your own Ansible-Python-Module (see https://medium.com/@auscunningham/write-a-ansible-module-with-python-527f0b292b4d) and integrate it some Python-Libraries (https://realpython.com/creating-modifying-pdf/). After that you can use the newly created python-module inside your playbooks or roles. It depends on your input (structured data) that need to be send to the module during execution.

Another option is to use some command line tools to create a PDF from some source code (like LateX can do). So you install LateX (just as an example), create a text file (with template-module) and run a command to create the PDF based on the template.

Both works.