Member-only story

Concatenate multiple files in a specific order — Ansible module template and YAML

How to automate the concatenation of multiple files and format using a list in the YAML and Ansible module template with Jinja2 language. Included example with “a.txt”, “b.txt” and “includes.yaml” files for Pandoc.

Luca Berton
5 min readFeb 1, 2022

How to use Concatenate multiple files in a specific order using Ansible?
This is extremely useful for service configuration files, reports, and so much more use cases. I personally use this code for markdown documents for Pandoc.
I’m going to show you a live demo with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible Concatenate multiple files in a specific order

  • ansible.builtin.template
  • Template a file out to a target host
  • ansible_managed, template_host, template_uid, template_path, template_fullpath, template_destpath, and template_run_date

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet