{"id":3813,"sha1":"86d84b6b4d33cce89026f1d68348a824443e85a7","playbook":{"id":1932,"items":{"plays":1,"tasks":7,"results":7,"hosts":1,"files":6,"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":"versatile-chipmunk.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":["remove_ini_blocks.yaml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"},{"id":80,"name":"subset:versatile-chipmunk.man-1.vm.plesk-server.com"}],"started":"2024-09-13T10:24:29.250717+01:00","ended":"2024-09-13T10:24:34.029454+01:00","duration":"00:00:04.778737","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/remove_ini_blocks.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Remove specific monitoring blocks\n  hosts: all\n  gather_facts: true\n  roles:\n    - plesk\n  tasks:\n    - name: Execute on plesk servers\n      when: plesk_found\n      block:\n        - name: Backup /etc/agent360-custom.ini with a timestamp\n          ansible.builtin.copy:\n            src: /etc/agent360-custom.ini\n            dest: \"/etc/agent360-custom.ini.bak_{{ ansible_date_time.epoch }}\"\n            remote_src: true\n            mode: '0644'\n\n        - name: Read the /etc/agent360-custom.ini file\n          ansible.builtin.slurp:\n            path: /etc/agent360-custom.ini\n          register: agent_ini_file\n\n        - name: Remove php_errors_monitoring block\n          ansible.builtin.replace:\n            path: /etc/agent360-custom.ini\n            regexp: '(\\[php_errors_monitoring\\](?:\\n[^\\[]*)*)'\n            replace: ''\n          when: \"'[php_errors_monitoring]' in (agent_ini_file.content | b64decode)\"\n\n        - name: Remove apache_error_monitoring block (until next block or EOF)\n          ansible.builtin.replace:\n            path: /etc/agent360-custom.ini\n            regexp: '(\\[apache_error_monitoring\\](?:\\n[^\\[]*)*)'\n            replace: ''\n          when: \"'[apache_error_monitoring]' in (agent_ini_file.content | b64decode)\"\n\n        - name: Ensure exactly one blank line between INI blocks\n          ansible.builtin.replace:\n            path: /etc/agent360-custom.ini\n            regexp: '(\\n+)(\\[.*\\])'\n            replace: '\\n\\n\\2'\n","created":"2024-09-13T10:24:29.268033+01:00","updated":"2024-09-13T10:24:29.268054+01:00","path":"/home/ssh-gateway/ansible/kuly/remove_ini_blocks.yaml"}