Execution
Date 21 Aug 2024 11:00:12 +0100
Duration 00:00:33.50
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.4
ara 1.7.1 / 1.7.1
Python 3.10.10
Summary
32 Hosts
2 Tasks
61 Results
1 Plays
6 Files
0 Records

File: /home/ssh-gateway/ansible/roles/plesk/tasks/main.yml

---
# tasks file for plesk

- name: Check and capture Plesk version if binary exists
  ansible.builtin.shell: |
    if [[ -f /sbin/plesk ]]; then
      # Check for full version text
      plesk_version=$( /sbin/plesk -v | grep "Product version" | cut -d ":" -f2 )

      # Check if 'Plesk' exists in the output
      if [[ "$plesk_version" == *Plesk* ]]; then
        # Extract numeric version
        numeric_version=$(echo "$plesk_version" | sed "s/^[ \t]*//" | awk '{print $NF}')
        echo "Numeric Version: $numeric_version"
      else
        echo "Plesk not found in the output."
      fi
    else
      echo "Plesk binary not found at /sbin/plesk. Skipping."
    fi
  args:
    executable: /bin/bash
  register: plesk_output
  changed_when: false