1

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.

3
  • 2
    Ansible is a configuration management and orchestration tool, not a text formatter. Use a correct tool for the job. Sep 17, 2020 at 11:59
  • Actually, There is some dependancy on that file for the oncoming tasks in the playbook. We can convert that data using Python also. But just want to know, whether we can do the same using Ansible or not?
    – saffron
    Sep 17, 2020 at 14:41
  • 1
    You can run any command you want, but you still need to have a tool that converts text to PDF. Sep 17, 2020 at 14:43

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .