I have a strange result

hi all,

Why when i run this task :

  • name: Find /var/log files equal or greater than 10 megabytes ending with .old or .log.gz
    find:
    paths: /{{ role_path }}/files/groups/
    patterns: ‘&.txt’
    register: mes_fichiers_speciaux
    delegate_to: localhost

  • debug:
    var: mes_fichiers_speciaux

my variable “mes_fichiers_speciaux” have this result :

“atime”: 1552039858.9219189,
“ctime”: 1552039858.9179187,
“dev”: 65027,
“gid”: 1003,
“gr_name”: “ansible”,
“inode”: 125053,
“isblk”: false,
“ischr”: false,
“isdir”: false,
“isfifo”: false,
“isgid”: false,
“islnk”: false,
“isreg”: true,
“issock”: false,
“isuid”: false,
“mode”: “0644”,
“mtime”: 1552039858.9179187,
“nlink”: 1,
“path”: “//home/my_user/roles/http/files/groups/members.txt”,
“pw_name”: “ansible”,
“rgrp”: true,
“roth”: true,
“rusr”: true,
“size”: 76,
“uid”: 1003,
“wgrp”: false,
“woth”: false,
“wusr”: true,
“xgrp”: false,
“xoth”: false,
“xusr”: false

so i must have this result only :

members.txt ==> Who is the content of my repertory /{{ role_path }}/files/groups/

Than kyou very much !!

Regards,

hi all,

Why when i run this task :

- name: Find /var/log files equal or greater than 10 megabytes ending with .old or .log.gz
  find:
    paths: /{{ role_path }}/files/groups/
    patterns: '*&*.txt'
  register: mes_fichiers_speciaux
  delegate_to: localhost

- debug:
    var: mes_fichiers_speciaux

my variable "mes_fichiers_speciaux" have this result :

"atime": 1552039858.9219189,
                "ctime": 1552039858.9179187,
                "dev": 65027,
                "gid": 1003,
                "gr_name": "ansible",
                "inode": 125053,
                "isblk": false,
                "ischr": false,
                "isdir": false,
                "isfifo": false,
                "isgid": false,
                "islnk": false,
                "isreg": true,
                "issock": false,
                "isuid": false,
                "mode": "0644",
                "mtime": 1552039858.9179187,
                "nlink": 1,
                "path": "//home/my_user/roles/http/files/groups/members.txt",
                "pw_name": "ansible",
                "rgrp": true,
                "roth": true,
                "rusr": true,
                "size": 76,
                "uid": 1003,
                "wgrp": false,
                "woth": false,
                "wusr": true,
                "xgrp": false,
                "xoth": false,
                "xusr": false

so i must have this result only :

members.txt ==> Who is the content of my repertory /{{ role_path }}/files/groups/

Than kyou very much !!

Regards,

      Correct me if I am wrong, but you are looking for lines in the
log files that match the pattern, right? If that is the case, do you
mind providing one of the lines from the log file that matches the
search? I think it is a matter of chopping the line down to get the
string you want. But I could be wrong, hence why I want to see the
line in question.

You can sanitize any sensitive entries in the line if you want; I just
want to have a feeling of what you are looking for so I can offer
suggestions.