Execution
Date 27 Feb 2026 01:31:20 +0000
Duration 00:07:48.41
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.13
ara 1.7.4 / 1.7.4
Python 3.10.10
Summary
399 Hosts
10 Tasks
3566 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/ansible-luca/alt-plesk-php-checker.yaml

---
- name: RM10252 - PHP EOL Checker
  hosts: all
  gather_facts: true

  tasks:
    - name: Get Info
      plesk_info:
      register: plsk

    - name: List php handlers IDs
      ansible.builtin.shell: |
        set -o pipefail
        plesk bin php_handler --list | awk '{ print $1 }'
      args:
        executable: /bin/bash
      register: php_handlers
      changed_when: false
      failed_when: false
      when: (plsk.plesk_found)

    - name: Classify handlers presence
      ansible.builtin.set_fact:
        has_altphp84: >-
          {{
            (php_handlers.stdout | default('')) is search('(?m)^alt-php84-fpm$')
            and (php_handlers.stdout | default('')) is search('(?m)^alt-php84-cgi$')
            and (php_handlers.stdout | default('')) is search('(?m)^alt-php84-fastcgi$')
          }}

        has_altphp85: >-
          {{
            (php_handlers.stdout | default('')) is search('(?m)^alt-php85-fpm$')
            and (php_handlers.stdout | default('')) is search('(?m)^alt-php85-cgi$')
            and (php_handlers.stdout | default('')) is search('(?m)^alt-php85-fastcgi$')
          }}
  
        has_plesk84: >-
          {{
            (php_handlers.stdout | default('')) is search('(?m)^plesk-php84-fpm$')
            and (php_handlers.stdout | default('')) is search('(?m)^plesk-php84-cgi$')
            and (php_handlers.stdout | default('')) is search('(?m)^plesk-php84-fastcgi$')
          }}
  
        has_plesk85: >-
          {{
            (php_handlers.stdout | default('')) is search('(?m)^plesk-php85-fpm$')
            and (php_handlers.stdout | default('')) is search('(?m)^plesk-php85-cgi$')
            and (php_handlers.stdout | default('')) is search('(?m)^plesk-php85-fastcgi$')
          }}

      when: php_handlers is defined

    - name: Ensure output dir exists(localhost
      ansible.builtin.file:
        path: RM10252
        state: directory
        mode: "0755"
      delegate_to: localhost
      run_once: true

    - name: Record servers with alt-php84/85 AND plesk-php84/85
      ansible.builtin.lineinfile:
        create: true
        mode: "0644"
        path: RM10252/has_alt_and_plesk_84_85
        line: "{{ inventory_hostname }}"
      delegate_to: localhost
      when:
        - has_altphp84 and has_altphp85 and has_plesk84 and has_plesk85

    - name: Record servers with plesk-php84/85 but with missing alt-php84
      ansible.builtin.lineinfile:
        create: true
        mode: "0644"
        path: RM10252/has_plesk8485_altphp85__no_altphp84
        line: "{{ inventory_hostname }}"
      delegate_to: localhost
      when:
        - not has_altphp84 and has_altphp85 and has_plesk84 and has_plesk85

    - name: Record servers with plesk-php84/85 but with missing alt-php85
      ansible.builtin.lineinfile:
        create: true
        mode: "0644"
        path: RM10252/has_plesk8485_altphp84__no_altphp85
        line: "{{ inventory_hostname }}"
      delegate_to: localhost
      when:
        - has_altphp84 and not has_altphp85 and has_plesk84 and has_plesk85

    - name: Record servers with plesk-php84/85 but missing alt-php84/85
      ansible.builtin.lineinfile:
        create: true
        mode: "0644"
        path: RM10252/plesk_only_84_85
        line: "{{ inventory_hostname }}"
      delegate_to: localhost
      when:
        - has_plesk84 and has_plesk85 and not has_altphp84 and not has_altphp85

    - name: Record servers that don't have both alt and plesk-php84/85 (or no plesk/command)
      ansible.builtin.lineinfile:
        create: true
        mode: "0644"
        path: RM10252/has_none
        line: "{{ inventory_hostname }}"
      delegate_to: localhost
      when:
        - not (has_altphp84 and has_altphp85) and not (has_plesk84 and has_plesk85)