Execution
Date 02 Feb 2026 13:45:12 +0000
Duration 00:00:11.47
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.4 / 1.7.4
Python 3.10.10
Summary
1 Hosts
4 Tasks
4 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/RM10272-alt-php-version.yaml

---
- name: Check alt-php version
  hosts: all
  gather_facts: false
  vars:
    desired_version: "1-69"
  tasks:
    - name: Get server info
      plesk_info:
      register: plsk

    - name: Check alt-php-config version on Imunify/CloudLinux servers
      when: >
        plsk.plesk_found and
        (plsk.imunify_found or plsk.cloudlinux_found)
      block:
        - name: Gather RPM package facts
          ansible.builtin.package_facts:
            manager: auto
          changed_when: false

        - name: Fail if alt-php-config is not installed
          ansible.builtin.fail:
            msg: "alt-php-config package is NOT installed"
          when: "'alt-php-config' not in ansible_facts.packages"

        - name: Extract clean version (strip .el8/.el9 suffix)
          ansible.builtin.set_fact:
            installed_version: "{{ alt_php_pkg.version }}-{{ alt_php_pkg.release | regex_replace('\\.el[0-9]+.*$', '') }}"
          when: "'alt-php-config' in ansible_facts.packages"

        - name: Report version status
          ansible.builtin.debug:
            msg: |
              Package: alt-php-config
              Desired version: {{ desired_version }}
              Installed version: {{ installed_version }}
              Status: {{ 'OK' if installed_version == desired_version else 'MISMATCH' }}
          when: "'alt-php-config' in ansible_facts.packages"

        - name: Fail if version mismatch
          ansible.builtin.fail:
            msg: "alt-php-config version mismatch! Expected {{ desired_version }}, found {{ installed_version }}"
          when:
            - "'alt-php-config' in ansible_facts.packages"
            - installed_version != desired_version