Hi @myservertechnik I was just about to reply and say use the builtin find and file modules. I was also working on an example for find.
- name: Find all directories that match text
ansible.builtin.find:
paths: "{{ target_directory }}"
patterns: "some_text*"
recurse: true
file_type: directory
In this example I’ve created a variable for the path named “target_directory” which is convenient if you need to specify that more than once. I also noticed in your original command you set -type d which I believe corresponds to file_type: directory.