Member-only story
Check if a file exists on Windows-like systems — Ansible module win_stat
How to automate the checking of the “example.txt” file on the Desktop of the user in the Windows system and display a message or execute a task accordingly with Ansible Playbook.
4 min readMar 15, 2022
How to Check if a file exists on 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 check file exists on Windows-like systems
- `
ansible.windows.win_stat
` - Get information about Windows files
Today we’re talking about the Ansible module `win_stat`.
The full name is `ansible.windows.win_stat
`, which means that is part of the collection of modules specialized to interact with Windows target host.
It’s a module pretty stable and out for years.