Execution
Date 03 Nov 2025 09:33:40 +0000
Duration 00:02:40.46
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.3 / 1.7.3
Python 3.10.10
Summary
155 Hosts
3 Tasks
465 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/RM10179-create-fpm-error-report.yaml

---
- name: Check with the script for errors
  hosts: all
  gather_facts: false
  tasks:
    - name: Get server info
      plesk_info:
      register: plsk
    - name: On plesk server execute block
      when: plsk.plesk_found
      block:
        - name: Upload script
          ansible.builtin.copy:
            src: find_fpm_errors.sh
            dest: /root/find_fpm_errors.sh
            mode: '0755'
          changed_when: false
        - name: Execute the script
          ansible.builtin.shell: |
            set -o pipefail
            /root/find_fpm_errors.sh "{{ type }}"
          args:
            executable: /bin/bash
          register: script_out
          changed_when: false
        - name: Check if output has real problems (not just 'None')
          set_fact:
            has_real_problems: >-
              {{
                script_out.stdout is defined and
                script_out.stdout | length > 0 and
                (
                  script_out.stdout is not search('=== PROBLEMATIC HANDLERS IN USE ===\s*None\s*=== PROBLEMATIC HANDLERS NOT IN USE ===\s*None')
                )
              }}
        - name: Create human-readable output for each host with real problems
          when: has_real_problems | default(false)
          ansible.builtin.copy:
            content: |
              PHP Handler Error Report for {{ inventory_hostname }}
              ==========================================
              
              {{ script_out.stdout }}
              
              Summary:
              - This report shows problematic PHP handlers on {{ inventory_hostname }}
              - "PROBLEMATIC HANDLERS IN USE" lists handlers that have errors and are currently assigned to domains
              - "PROBLEMATIC HANDLERS NOT IN USE" lists handlers that have errors but are not currently assigned to domains
              - These handlers should be investigated and potentially replaced or fixed
            dest: "/home/ssh-gateway/ansible/kuly/host-reports/alt-php-errors-{{ inventory_hostname }}-{{ type }}.txt"
            mode: '0644'
          delegate_to: 127.0.0.1
          changed_when: false
        - name: Save summary line for hosts with real problems
          when: has_real_problems | default(false)
          ansible.builtin.lineinfile:
            path: "/home/ssh-gateway/ansible/kuly/alt-php-fpm-errors-{{ type }}.txt"
            line: "{{ inventory_hostname }} - has problematic PHP handlers"
            create: true
            mode: '0644'
          delegate_to: 127.0.0.1