Execution
Date 26 Feb 2026 10:36:17 +0000
Duration 00:00:02.01
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
0 Hosts
1 Tasks
0 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: false

  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 and plsk.imunify_found)

    - name: Classify handlers presence
      ansible.builtin.set_fact:
        has_altphp84: "{{ (php_handlers.stdout | default('')) is search('alt-php84') }}"
        has_altphp85: "{{ (php_handlers.stdout | default('')) is search('alt-php85') }}"
        has_plesk84: "{{ (php_handlers.stdout | default('')) is search('plesk-php84') }}"
        has_plesk85: "{{ (php_handlers.stdout | default('')) is search('plesk-php85') }}"
      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:
        - php_handlers is defined
        - has_altphp84 and 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:
        - php_handlers is defined
        - has_plesk84 and has_plesk85
        - not (has_altphp84 and has_altphp85)

    - name: Record servers that don't have 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:
        - php_handlers is not defined
          or not (has_altphp84 and has_altphp85) and not (plesk_php84 and plesk_php85)