Execution
Date 07 Aug 2024 12:49:47 +0100
Duration 00:00:02.67
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
2 Hosts
4 Tasks
4 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/projects/RM9682/RM9682.yaml

---
- name: Playbook to parse plesk ini file
  hosts: all
  gather_facts: false
  vars:
    ini_file: /usr/local/psa/admin/conf/panel.ini
    ara_playbook_name: RM9682.yaml
    ara_playbook_labels:
      - plesk
      - panelini
  tasks:
    - name: Run plesk command and capture output
      ansible.builtin.shell: |
        set -o pipefail
        /sbin/plesk -v | grep "Product version" | cut -d ":" -f2
      args:
        executable: /bin/bash
      register: plsk_out
      changed_when: false
    - name: Run the script when it is a Plesk server upload and execute script
      when: "'Plesk' in plsk_out.stdout"
      block:
        - name: Read the localfile
          ansible.builtin.slurp:
            src: /home/ssh-gateway/ansible/projects/RM9682/configure_plesk_updates.sh
          delegate_to: 127.0.0.1
          register: file_contents
        - name: Execute uploaded script
          ansible.builtin.shell: |
            set -o pipefail
            echo -e "{{ file_contents.content }}" | base64 -d > /tmp/configure_plesk_updates.sh
            chmod 755 /tmp/configure_plesk_updates.sh
            cp "{{ ini_file }}" "{{ ini_file }}".back-$(date +%s)
            /tmp/configure_plesk_updates.sh
          args:
            executable: /bin/bash
          register: updates_out
          changed_when: true
        - name: Show debug
          ansible.builtin.debug:
            var: updates_out