Member-only story

Create an empty file in Windows-like systems — Ansible module win_file

How to automate the creation of an empty “example.txt” in the Desktop of your users in Windows-like systems with Ansible Playbook.

Luca Berton
4 min readJan 27, 2022

How to create an empty file in Windows-like systems with Ansible?

I’m going to show you a live demo and some simple Ansible code.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible creates an empty file

  • `ansible.windows.win_file`
  • Creates, touches, or removes files or directories

Today we’re talking about the Ansible module `win_file`.

The full name is `ansible.windows.win_file`, which means that is part of the collection of modules to interact with windows machines.

It’s a module pretty stable and out for years.

It creates, touches, or removes files or directories.

For Linux targets, use the ansible.builtin.file module instead.

Parameters

  • path path — file path

--

--

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