{"id":5120,"sha1":"2d0e2716fdf4be28231ffbadd840193caa611110","playbook":{"id":3014,"items":{"plays":1,"tasks":9,"results":9,"hosts":2,"files":1,"records":0},"arguments":{"version":null,"verbosity":2,"private_key_file":"/home/ssh-gateway/.ssh/id_rsa","remote_user":"root","connection":"ssh","timeout":null,"ssh_common_args":null,"sftp_extra_args":null,"scp_extra_args":null,"ssh_extra_args":null,"ask_pass":false,"connection_password_file":null,"force_handlers":false,"flush_cache":false,"become":false,"become_method":"sudo","become_user":null,"become_ask_pass":false,"become_password_file":null,"tags":["all"],"skip_tags":[],"check":false,"diff":false,"inventory":["/home/ssh-gateway/ansible/kuly/bash-kvm-inventory-prod.sh"],"listhosts":false,"subset":"aqua-lemur.man-1.vm.plesk-server.com","extra_vars":"Not saved by ARA as configured by 'ignored_arguments'","vault_ids":[],"ask_vault_pass":false,"vault_password_files":[],"forks":20,"module_path":null,"syntax":false,"listtasks":false,"listtags":false,"step":false,"start_at_task":null,"args":["RM10018-update-wptoolkit.yaml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"},{"id":192,"name":"subset:aqua-lemur.man-1.vm.plesk-server.com"}],"started":"2025-05-23T12:25:21.514141+01:00","ended":"2025-05-23T12:25:26.475496+01:00","duration":"00:00:04.961355","name":null,"ansible_version":"2.16.11","client_version":"1.7.2","python_version":"3.10.10","server_version":"1.7.2","status":"completed","path":"/home/ssh-gateway/ansible/kuly/RM10018-update-wptoolkit.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Update Plesk panel.ini with ext-wp-toolkit settings (if Plesk server)\n  hosts: all\n  gather_facts: false\n\n  vars:\n    panel_ini_path: \"/usr/local/psa/admin/conf/panel.ini\"\n    section_header: \"[ext-wp-toolkit]\"\n    config_block: |\n      [ext-wp-toolkit]\n      showVirtualPatchesUpsellWhenRestrictedViaPlans = true\n      purchaseDeluxeGuardianBaseUrl = https://plesk.layershift.com/\n      virtualPatchesLicenseAdditionalLimit = 0\n      virtualPatchesLicensingForEndCustomers = false\n\n  tasks:\n    - name: Get the Plesk info\n      plesk_info:\n      register: plsk\n\n    - name: Conditional block for updating panel.ini (only on Plesk servers)\n      when: plsk.plesk_found\n      block:\n        - name: Check if section exists in panel.ini file\n          ansible.builtin.shell: \"grep -qF '{{ section_header }}' {{ panel_ini_path }} && echo 'found' || echo 'not found'\"\n          register: section_exists_result\n          changed_when: false\n          args:\n            _uses_shell: true\n\n        - name: Set fact based on whether section exists\n          ansible.builtin.set_fact:\n            section_exists: \"{{ section_exists_result.stdout == 'found' }}\"\n\n        - name: Alert if section is already present\n          ansible.builtin.debug:\n            msg: \"\u26a0\ufe0f Section {{ section_header }} already exists in {{ panel_ini_path }}. No changes will be made.\"\n          when: section_exists\n\n        - name: Generate timestamp for backup filename\n          ansible.builtin.shell: date +'%Y-%m-%d_%H-%M-%S'\n          delegate_to: localhost\n          run_once: true\n          register: timestamp_result\n\n        - name: Set backup path using generated timestamp\n          ansible.builtin.set_fact:\n            backup_path: \"{{ panel_ini_path }}_{{ timestamp_result.stdout }}\"\n\n        - name: Backup panel.ini before modifying\n          ansible.builtin.copy:\n            src: \"{{ panel_ini_path }}\"\n            dest: \"{{ backup_path }}\"\n            remote_src: true\n            mode: '0644'\n          when: not section_exists\n\n        - name: Append configuration block to panel.ini\n          ansible.builtin.lineinfile:\n            dest: \"{{ panel_ini_path }}\"\n            line: \"{{ config_block }}\"\n            create: false\n          when: not section_exists\n\n        - name: Notify user of successful update\n          ansible.builtin.debug:\n            msg: \"\u2705 Configuration successfully added to {{ panel_ini_path }}\"\n          when: not section_exists\n","created":"2025-05-23T12:25:21.528946+01:00","updated":"2025-05-23T12:25:21.528966+01:00","path":"/home/ssh-gateway/ansible/kuly/RM10018-update-wptoolkit.yaml"}