Hi all, I'm trying combine find module and mail module to report to my email only the list of files I need that were finded in specific folder. I try many ways but always receive full output. Do anyone can help?
*My tasks* > > --- > - name: check if tar files exists > find: > paths: "{{ bkPath }}" > patterns: '*.tar' > register: backup_existed > > - name: results output > debug: > msg: "{{ item.path }}" > with_items: "{{ backup_existed.files }}" > register: backup_output > > - name: Report through email > mail: > host: smtp.gmail.com > port: 587 > username: my_gm...@gmail.com > password: SecretPass > to: Khang Tran <my_working@email> > subject: Ansible-Backup-Report > body: > > Backup files list: > - {{ backup_output }} > charset: utf-8 > delegate_to: localhost > *Actually Email report:* Backup files list: - {'msg': > u'/20190625/AS/mcpAcct.2019_06_25.16_46_45.tar', '_ansible_verbose_always': > True, '_ansible_ignore_errors': True, '_ansible_item_label': {u'uid': 1003, > u'woth': False, u'mtime': 1561456341.9453063, u'inode': 596799269, > u'isgid': False, u'size': 3205120, u'roth': True, u'isuid': False, > u'isreg': True, u'pw_name': u'labbackup', u'gid': 1003, u'ischr': False, > u'wusr': True, u'xoth': False, u'rusr': True, u'nlink': 1, u'issock': > False, u'rgrp': True, u'gr_name': u'labbackup', u'path': > u'/20190625/AS/mcpAcct.2019_06_25.16_46_45.tar', u'xusr': False, u'atime': > 1561456341.6703176, u'isdir': False, u'ctime': 1561456341.9453063, > u'isblk': False, u'xgrp': False, u'dev': 64770, u'wgrp': True, u'isfifo': > False, u'mode': u'0664', u'islnk': False}}, {'changed': False, > '_ansible_no_log': False, 'item': {u'uid': 1003, u'woth': False, u'mtime': > 1561456341.951306, u'inode': 596799270, u'isgid': False, u'size': 40960, > u'roth': True, u'isuid': False, u'isreg': True, u'pw_name': u'labbackup', > u'gid': 1003, u'ischr': False, u'wusr': True, u'xoth': False, u'rusr': > True, u'nlink': 1, u'issock': False, u'rgrp': True, u'gr_name': > u'labbackup', u'path': u'/20190625/AS/mcpAcct.2019_06_25.16_51_33.tar', > u'xusr': False, u'atime': 1561456341.9463062, u'isdir': False, u'ctime': > 1561456341.951306, u'wgrp': True, u'xgrp': False, u'dev': 64770, u'isblk': > False, u'isfifo': False, u'mode': u'0664', u'islnk': False}, > '_ansible_item_result': True, 'failed': False } > *Expected Email report contain:* Backup files list: > - /20190625/AS/mcpAcct.2019_06_25.16_46_45.tar > - /20190625/AS/mcpAcct.2019_06_25.16_51_33.tar > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e54b4129-e863-4757-a16e-16dbf8f60dcf%40googlegroups.com.