system-config/playbooks/roles/logrotate/tasks/cleanup.yaml

10 lines
347 B
YAML

# Hash the full path to avoid any conflicts but remain idempotent.
- name: Create a unique config name
set_fact:
logrotate_generated_config_file_name: "{{ (logrotate_file_name | hash('sha1'))[0:6] }}.conf"
- name: Cleanup the indicated file
file:
state: absent
path: '/etc/logrotate.d/{{ logrotate_generated_config_file_name }}'