Member-only story

Create a text file — Ansible module copy

How to create a simple text file? I’m going to show you a live demo with some simple Ansible code.

Luca Berton
4 min readSep 21, 2021

How to create a simple text file?

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 create a text file

Today we’re talking about Ansible module copy.
The full name is ansible.builtin.copy which means is part of the collection of modules “builtin” with ansible and shipped with it.
This module is pretty stable and out for years.
The purpose is to copy files to remote locations but it’s also capable to create some simple text files.
If you need a more complex configuration it’s better to rely on the template module.

Parameters

  • dest path — destination file
  • content string — text
  • mode/owner/group — permission
  • setype/seuser/selevel — SELinux

--

--

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