{"id":6434,"sha1":"98c6e4486912c3d27249994dec39417349a2f12b","playbook":{"id":4314,"items":{"plays":1,"tasks":6,"results":6,"hosts":1,"files":1,"records":0},"arguments":{"version":null,"verbosity":0,"private_key_file":"/home/ssh-gateway/.ssh/id_rsa","remote_user":"root","connection":"ssh","timeout":null,"ssh_common_args":null,"sftp_extra_args":null,"scp_extra_args":null,"ssh_extra_args":null,"ask_pass":false,"connection_password_file":null,"force_handlers":false,"flush_cache":false,"become":false,"become_method":"sudo","become_user":null,"become_ask_pass":false,"become_password_file":null,"tags":["all"],"skip_tags":[],"check":false,"diff":false,"inventory":["/home/ssh-gateway/ansible/kuly/bash-kvm-inventory-prod.sh"],"listhosts":false,"subset":"wise-river.sin-1.vm.plesk-server.com","extra_vars":"Not saved by ARA as configured by 'ignored_arguments'","vault_ids":[],"ask_vault_pass":false,"vault_password_files":[],"forks":20,"module_path":null,"syntax":false,"listtasks":false,"listtags":false,"step":false,"start_at_task":null,"args":["zz-rm10179-check-for-php-errors.yaml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"},{"id":72,"name":"subset:wise-river.sin-1.vm.plesk-server.com"}],"started":"2025-11-07T09:30:33.231624Z","ended":"2025-11-07T09:30:54.229566Z","duration":"00:00:20.997942","name":null,"ansible_version":"2.16.11","client_version":"1.7.3","python_version":"3.10.10","server_version":"1.7.3","status":"failed","path":"/home/ssh-gateway/ansible/kuly/zz-rm10179-check-for-php-errors.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Check for PHP FPM errors using standalone script\n  hosts: all\n  gather_facts: false\n  tasks:\n    - name: Get server info\n      plesk_info:\n      register: plsk\n\n    - name: On plesk server execute block\n      when: plsk.plesk_found\n      block:\n        - name: Upload standalone FPM error check script\n          ansible.builtin.copy:\n            src: zz-rm10179-check-for-php-errors.sh\n            dest: /root/zz-rm10179-check-for-php-errors.sh\n            mode: '0755'\n          changed_when: false\n\n        - name: Execute the FPM error check script\n          ansible.builtin.shell: |\n            set -o pipefail\n            /root/zz-rm10179-check-for-php-errors.sh --check-only\n          args:\n            executable: /bin/bash\n          register: script_out\n          failed_when: false  # Don't fail the playbook on non-zero exit code\n          changed_when: >\n            (script_out.rc != 0) or\n            (':warning:' in script_out.stdout) or\n            (':gear:' in script_out.stdout)\n\n        - name: Extract clean status components\n          ansible.builtin.set_fact:\n            # Extract just the handler lists without the prefixes\n            in_use_clean: \"{{ (script_out.stdout | regex_search('in use: ([^,]+(?:, [^,]+)*)') | default('None') | regex_replace('in use: ', '') | trim) }}\"\n            manual_fix_clean: \"{{ (script_out.stdout | regex_search('need manual: ([^,]+(?:, [^,]+)*)') | default('None') | regex_replace('need manual: ', '') | trim) }}\"\n            would_fix_clean: \"{{ (script_out.stdout | regex_search('would fix: ([^,]+(?:, [^,]+)*)') | default('None') | regex_replace('would fix: ', '') | trim) }}\"\n            \n        - name: Extract counts for summary\n          ansible.builtin.set_fact:\n            in_use_count: \"{{ (in_use_clean.split(',') | length) if in_use_clean != 'None' else 0 }}\"\n            manual_fix_count: \"{{ (manual_fix_clean.split(',') | length) if manual_fix_clean != 'None' else 0 }}\"\n            would_fix_count: \"{{ (would_fix_clean.split(',') | length) if would_fix_clean != 'None' else 0 }}\"\n\n        - name: Create clean summary line\n          ansible.builtin.set_fact:\n            summary_line: |\n              {{ inventory_hostname }} - \n              {% if in_use_count > 0 %}\u274c {{ in_use_count }} in-use: {{ in_use_clean }}{% endif %}\n              {% if manual_fix_count > 0 %}{% if in_use_count > 0 %}, {% endif %}\ud83d\udd27 {{ manual_fix_count }} manual: {{ manual_fix_clean }}{% endif %}\n              {% if would_fix_count > 0 %}{% if in_use_count > 0 or manual_fix_count > 0 %}, {% endif %}\u2705 {{ would_fix_count }} would-fix: {{ would_fix_clean }}{% endif %}\n              {% if in_use_count == 0 and manual_fix_count == 0 and would_fix_count == 0 %}\u2705 Clean - No PHP FPM errors{% endif %}\n              | RC: {{ script_out.rc }}\n\n        - name: Display clean summary and save to file\n          ansible.builtin.lineinfile:\n            path: \"/home/ssh-gateway/ansible/kuly/zz-rm10179-check-for-php-errors.txt\"\n            line: \"{{ summary_line | trim | regex_replace('\\\\s+', ' ') }}\"\n            create: true\n            mode: '0644'\n          delegate_to: 127.0.0.1\n\n        - name: Show detailed output when problems found\n          ansible.builtin.debug:\n            msg: |\n              FPM Error Check Results for {{ inventory_hostname }}:\n              {{ script_out.stdout }}\n          when: >\n            (script_out.rc != 0) or\n            (':warning:' in script_out.stdout) or\n            (':gear:' in script_out.stdout) or\n            (':check:' in script_out.stdout and 'would fix' in script_out.stdout)\n\n        - name: Show success message when no problems\n          ansible.builtin.debug:\n            msg: \"\u2705 No PHP FPM errors found on {{ inventory_hostname }}\"\n          when: >\n            (script_out.rc == 0) and\n            (':warning:' not in script_out.stdout) and\n            (':gear:' not in script_out.stdout) and\n            (':check:' not in script_out.stdout or 'No problems found' in script_out.stdout)\n","created":"2025-11-07T09:30:33.256447Z","updated":"2025-11-07T09:30:33.256471Z","path":"/home/ssh-gateway/ansible/kuly/zz-rm10179-check-for-php-errors.yaml"}