Created
May 19, 2020 16:30
-
-
Save luckylittle/54ccc322e4ac07ecc391431beab8573a to your computer and use it in GitHub Desktop.
Red Hat Ansible aws_s3 module filter example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Tested on Ansible 2.9.4 | |
# aws_s3 module lists all objects, including folders - that is sometimes undesirable | |
# Copyright (c) 2020 Lucian Maly, Red Hat | |
- hosts: localhost | |
gather_facts: false | |
vars: | |
s3_keys: | |
- "ESRI_PATCHES/ArcGIS_Server/1071/" | |
- "ESRI_PATCHES/ArcGIS_Server/1071/ArcGIS-1071-S-GG-Patch.msp" | |
- "ESRI_PATCHES/ArcGIS_Server/1071/ArcGIS-1071-S-MWJUN2019SUC-Patch.msp" | |
- "ESRI_PATCHES/ArcGIS_Server/1071/ArcGIS-1071-S-SSP-Patch.msp" | |
- "ESRI_PATCHES/ArcGIS_Server/1071/ArcGIS-1071-S-TD-Patch.msp" | |
- "ESRI_PATCHES/ArcGIS_Server/1071/ArcGIS-1071-S-USR-Patch.msp" | |
tasks: | |
- name: List without the root folder object (only the files) | |
debug: | |
msg: "{{ item }}" | |
loop: | |
- "{{ s3_keys | select('match', '^.*.msp$') | list }}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Returns: