Execution
Date 20 Aug 2024 15:36:48 +0100
Duration None
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
29 Hosts
6 Tasks
84 Results
1 Plays
6 Files
0 Records

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

---
# tasks file for plesk

- name: Run Plesk command and capture full version text
  ansible.builtin.shell: |
    set -o pipefail
    /sbin/plesk -v | grep "Product version" | cut -d ":" -f2
  args:
    executable: /bin/bash
  register: plsk_full_out
  changed_when: false

- name: Set fact for full Plesk version text
  set_fact:
    plesk_version: "{{ plsk_full_out.stdout | trim }}"
  when: plsk_full_out.rc == 0 and 'Plesk' in plsk_full_out.stdout

- name: Run Plesk command and capture numeric version only
  ansible.builtin.shell: |
    set -o pipefail
    /sbin/plesk -v | grep "Product version" | cut -d ":" -f2 | sed "s/^[ \t]*//" | awk '{print $NF}'
  args:
    executable: /bin/bash
  register: plsk_numeric_out
  when: "'Plesk' in plsk_full_out.stdout"
  changed_when: false

- name: Set fact for numeric Plesk version
  set_fact:
    plesk_ver_num: "{{ plsk_numeric_out.stdout | trim }}"
  when: plsk_numeric_out.rc == 0 and 'Plesk' in plsk_full_out.stdout

- name: Debug full and numeric Plesk versions
  debug:
    msg:
      - "Text is {{ plesk_version }}"
      - "Version is {{ plesk_ver_num }}"
  when: "'Plesk' in plsk_full_out.stdout"