Member-only story

Apply a file template — Ansible module template — HTML placeholder

How to create and use templates in Ansible Playbooks. An included example is how to deploy an HTML placeholder using the Jinga2 template in your Nginx webserver.

Luca Berton
6 min readNov 23, 2021

How to apply a file template to the target host with Ansible?

This is extremely useful for service configuration files, placeholder web pages, reports, and so much more use cases.

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 applies a file template

  • 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

Today we’re talking about Ansible module template.

The full name is ansible.builtin.template, it’s part of `ansible-core` and is included in all Ansible installations.

--

--

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