Member-only story

Copy Multiple Files to Remote Hosts— Ansible lookup plugin fileglob

How to automate the copy of the “example/*.txt” files to a target host using the with_fileglob Ansible loop statement and Ansible lookup plugin fileglob.

Luca Berton
5 min readJan 17, 2022

How to Copy Multiple Files with Ansible?

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 Copy Multiple Files

  • `ansible.builtin.fileglob`
  • list files matching a pattern

Today we’re talking about the Ansible lookup plugin fileglob.

Plugins are a way to expand the Ansible functionality. With lookup plugins specifically, you can load variables or templates with information from external sources.

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

The purpose of the lookup plugin is to list files matching a pattern.

Usage

--

--

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