Hi guys,
So I have been using the following simple playbook to keep a folder clean
from files. Everything is working fine. However, I got into thinking that
it will not hurt, if I get a notification, containing what has been deleted.
So my question is - may I use the variable into a body of an email? I have
tried to view the contents of the registered variable, and I cannot seem to
find a way.
How can I configure an email that will have something like "I have deleted
the following files - file1, file2, etc.?
Thank you in advance.
---
- hosts: lxc
tasks:
- name: Finding older than 1 week files in the distfiles folder
find:
paths: /var/cache/distfiles
age: 1w
recurse: no
register: files_to_delete
- name: Removing the founded files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ files_to_delete.files }}"
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/1fd1fcbe-4150-49b8-93c0-9a6aa5879da9n%40googlegroups.com.