Execution
Date 23 Jan 2026 07:00:27 +0000
Duration 00:00:01.19
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.4 / 1.7.4
Python 3.10.10
Summary
1 Hosts
2 Tasks
2 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/zz-rm-logrotate.yaml

---
- name: Remove Ansible-generated backup files
  hosts: all
  gather_facts: false
  vars:
    # Specify the directory or list of paths to clean
    target_paths:
      - /etc/logrotate.d/alt-php80-fpm.logrotate
      - /etc/logrotate.d/alt-php81-fpm.logrotate
      - /etc/logrotate.d/alt-php82-fpm.logrotate
      - /etc/logrotate.d/alt-php83-fpm.logrotate
      - /etc/logrotate.d/alt-php84-fpm.logrotate
      - /etc/logrotate.d/alt-php85-fpm.logrotate

  tasks:
    - name: Find Ansible backup files (ending with ~)
      ansible.builtin.find:
        paths: "{{ target_paths }}"
        patterns: "*~"
        file_type: file
      register: ansible_backups

    - name: Delete found Ansible backup files
      ansible.builtin.file:
        path: "{{ item.path }}"
        state: absent
      loop: "{{ ansible_backups.files }}"
      when: ansible_backups.files | length > 0