pull/83600/head
HS-157 4 months ago
parent 550e1e5708
commit be6e985313

@ -35,16 +35,16 @@ EXAMPLES = """
- name: Display paths of all .md files in recursively directories
ansible.builtin.debug: msg={{ lookup('ansible.builtin.fileglob', '**/*.md') }}
- name: Display paths of .json start name with « 2 », « 3 » or « 23 »
- name: Display paths of .json start name with « 2 », « 3 » or « 23 »
ansible.builtin.debug: msg={{ lookup('ansible.builtin.fileglob', 'path/[23]-foobar.json') }}
- name: Display paths of .json start name without « 2 », « 3 » or « 23 »
- name: Display paths of .json start name without « 2 », « 3 » or « 23 »
ansible.builtin.debug: msg={{ lookup('ansible.builtin.fileglob', 'path/[!23]-foobar.json') }}
- name: Display paths of .txt files matches any single character in foo directory
ansible.builtin.debug: msg={{ lookup('ansible.builtin.fileglob', 'foo/b?r.txt') }}
- name: Display paths of all .json start name with « 2 », « 3 » or « 23 » recursively in matches any single character dir
- name: Display paths of all .json start name with « 2 », « 3 » or « 23 » recursively in matches any single character dir
ansible.builtin.debug: msg={{ lookup('ansible.builtin.fileglob', 'f?o/**/[23]-*.json') }}
- name: Copy each file over that matches the given pattern

@ -1 +1,3 @@
from __future__ import annotations
print("Hi !")

@ -0,0 +1,3 @@
from __future__ import annotations
print("Bor")

@ -1 +1,3 @@
from __future__ import annotations
print("Hello !")

@ -1,64 +1,64 @@
- name: "Find exact name file in root dir"
assert:
that:
- q("fileglob", "hello.py") | length == 1
- q("fileglob", "hello.py") | length == 1
- name: "All .md file in dir"
assert:
that:
- q("fileglob", "toto/*.md") | length == 3
- q("fileglob", "toto/*.md") | length == 3
- name: "All .md files in first level dir"
assert:
that:
- q("fileglob", "*/*.md") | length == 4
- q("fileglob", "*/*.md") | length == 4
- name: "All .md files"
assert:
that:
- q("fileglob", "**/*.md") | length == 5
- q("fileglob", "**/*.md") | length == 5
- name: "Find file outside « files » dir"
assert:
that:
- q("fileglob", "not_files_dir/coucou.*") | length == 3
- q("fileglob", "not_files_dir/coucou.*") | length == 3
- name: "Find file outside « role » dir"
assert:
that:
- q("fileglob", "outside_role/*") | length == 5
- q("fileglob", "outside_role/*") | length == 5
- name: "Find all .py file in recursive dir"
assert:
that:
- q("fileglob", "**/*.py") | length == 9
- q("fileglob", "**/*.py") | length == 9
- name: "Find all .py with same name in recursive dir"
assert:
that:
- q("fileglob", "**/bar.py") | length == 5
- q("fileglob", "**/baar.py") | length == 5
- name: "Find all file in recursive dir"
assert:
that:
- q("fileglob", "**/*") | length == 14
- q("fileglob", "**/*") | length == 14
- name: "Find all .py file in dir with « 2 », « 3 » or « 23 » in endname"
- name: "Find all .py file in dir with « 2 », « 3 » or « 23 » in endname"
assert:
that:
- q("fileglob", "foo/*[23]/*.py") | length == 3
- q("fileglob", "foo/*[23]/*.py") | length == 3
- name: "Find all .py file in dir without « 2 », « 3 » or « 23 » in endname"
- name: "Find all .py file in dir without « 2 », « 3 » or « 23 » in endname"
assert:
that:
- q("fileglob", "foo/*[!23]/*.py") | length == 2
- q("fileglob", "foo/*[!23]/*.py") | length == 2
- name: "Find file with matches any single character"
assert:
that:
- q("fileglob", "outside_role/t?t?.txt") | length == 3
- q("fileglob", "outside_role/t?t?.txt") | length == 3
- name: "Find file with matches any single character in recursive dir"
assert:
that:
- q("fileglob", "**/b?r.py") | length == 6
- q("fileglob", "**/b?ar.py") | length == 6

@ -17,5 +17,5 @@ done
# test for issue 72873 fix
ansible-playbook issue72873/test.yml "$@"
# Test recursive and other match
# Test recursive and other match
ansible-playbook recursive/play.yml "$@"

Loading…
Cancel
Save