{"id":5606,"sha1":"8bf79e1cca3824aef1aabef8fe8f07d589216f3a","playbook":{"id":3486,"items":{"plays":1,"tasks":7,"results":7,"hosts":1,"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":"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":["RM10092_agent360_conf_change.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":"2025-07-24T09:52:46.009397+01:00","ended":"2025-07-24T09:52:47.984954+01:00","duration":"00:00:01.975557","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/RM10092_agent360_conf_change.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Search for diskusage block in file\n  hosts: all\n  gather_facts: false\n  vars:\n    config_file: \"/etc/agent360.ini\"\n  tasks:\n    - name: Read the configuration file\n      ansible.builtin.slurp:\n        src: \"{{ config_file }}\"\n      register: file_content\n      ignore_errors: true\n\n    - name: Fail if file doesn't exist\n      ansible.builtin.fail:\n        msg: \"File {{ config_file }} not found\"\n      when: file_content is failed\n\n    - name: Decode file content\n      ansible.builtin.set_fact:\n        decoded_content: \"{{ (file_content.content | b64decode).splitlines() }}\"\n\n    - name: Extract diskusage block\n      ansible.builtin.set_fact:\n        diskusage_block: \"{{ decoded_content | select('match', '\\\\[diskusage\\\\]') | list }}\"\n\n    - name: Find diskusage block and extract content\n      ansible.builtin.set_fact:\n        block_content: |\n          {% set found_block = false %}\n          {% set result = [] %}\n          {% for line in decoded_content %}\n          {%   if line.strip() == '[diskusage]' %}\n          {%     set found_block = true %}\n          {%   elif found_block and line.startswith('[') and line.endswith(']') and line != '[diskusage]' %}\n          {%     set found_block = false %}\n          {%   elif found_block %}\n          {%     set result = result.append(line) %}\n          {%   endif %}\n          {% endfor %}\n          {{ result | join('\\n') }}\n        block_found: |\n          {% set found = false %}\n          {% for line in decoded_content %}\n          {%   if line.strip() == '[diskusage]' %}\n          {%     set found = true %}\n          {%   endif %}\n          {% endfor %}\n          {{ found }}\n\n    - name: Display diskusage block content\n      ansible.builtin.debug:\n        msg: |\n          Diskusage block content:\n          =======================\n          {{ block_content }}\n      when: block_found | bool\n\n    - name: Display message if block not found\n      ansible.builtin.debug:\n        msg: \"Block [diskusage] not found in the file\"\n      when: not (block_found | bool)\n","created":"2025-07-24T09:52:46.023843+01:00","updated":"2025-07-24T09:52:46.023866+01:00","path":"/home/ssh-gateway/ansible/kuly/RM10092_agent360_conf_change.yaml"}