Execution
Date 24 Feb 2026 19:47:49 +0000
Duration 00:31:35.96
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
398 Hosts
3 Tasks
1189 Results
1 Plays
1 Files
0 Records

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

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

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

    - name: Install both plesk-php84 and plesk-php85 handlers
      ansible.builtin.shell: |
        set -o pipefail
        handlers="$(plesk bin php_handler --list || true)"

        need_84=0
        need_85=0

        echo "$handlers" | grep -q 'plesk-php84' || need_84=1
        echo "$handlers" | grep -q 'plesk-php85' || need_85=1

        if [ "$need_84" -eq 1 ]; then
           echo "plesk-php84 missing -> installing php8.4 component"
           plesk installer add --components php8.4
        else
           echo "plesk-php84 present -> skip"
        fi

        if [ "$need_85" -eq 1 ]; then
           echo "plesk-php85 missing -> installing php8.5 component"
           plesk installer add --components php8.5
        else
           echo "plesk-php85 present -> skip"
        fi

      args:
        executable: /bin/bash
      register: php_install
      when: (plsk.plesk_found and plsk.imunify_found) or (plsk.plesk_found and plsk.cloudlinux_found)
      changed_when: "'installing php8.4' in php_install.stdout or 'installing php8.5' in php_install.stdout"
      failed_when: false

    - name: Record servers where plesk-php84 or plesk-php85 was installed
      ansible.builtin.lineinfile:
        create: true
        mode: '0644'
        path: RM10252/hostnames
        line: "{{ inventory_hostname }}"
      when: php_check.rc != 0
      delegate_to: localhost