{"id":2198,"sha1":"fbf728de3a9ac95c7724d3327acbb7e526def1f1","playbook":{"id":1510,"items":{"plays":1,"tasks":1,"results":1,"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":["gather_facts_test1.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-04T13:12:24.963455+01:00","ended":"2024-09-04T13:12:25.717522+01:00","duration":"00:00:00.754067","name":null,"ansible_version":"2.16.4","client_version":"1.7.1","python_version":"3.10.10","server_version":"1.7.1","status":"failed","path":"/home/ssh-gateway/ansible/kuly/gather_facts_test1.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Gather and save system facts\n  hosts: all\n  tasks:\n\n    - name: Upload gather_facts.sh script to the remote host\n      ansible.builtin.copy:\n        src: files/gather_facts.sh\n        dest: /tmp/gather_facts.sh\n        mode: '0755'\n\n    - name: Execute the gather_facts.sh script and save the output\n      ansible.builtin.command: /tmp/gather_facts.sh\n      register: script_output\n\n    - name: Parse the script output and convert it into a JSON format\n      ansible.builtin.set_fact:\n        custom_facts: |\n          {\n            \"os_version\": \"{{ script_output.stdout_lines[1].split(':')[1] | trim }}\",\n            \"kernel_version\": \"{{ script_output.stdout_lines[2].split(':')[1] | trim }}\",\n            \"cpu_architecture\": \"{{ script_output.stdout_lines[3].split(':')[1] | trim }}\",\n            \"total_memory\": \"{{ script_output.stdout_lines[4].split(':')[1] | trim }}\",\n            \"disk_space\": \"{{ script_output.stdout_lines[5].split(':')[1] | trim }}\"\n          }\n\n    - name: Create the directory for storing custom facts\n      ansible.builtin.file:\n        path: /etc/ansible/facts.d\n        state: directory\n        mode: '0755'\n\n    - name: Save the custom facts in JSON format\n      ansible.builtin.copy:\n        content: \"{{ custom_facts | to_nice_json }}\"\n        dest: /etc/ansible/facts.d/custom_facts.fact\n        mode: '0644'\n\n    - name: Display the custom facts\n      ansible.builtin.debug:\n        var: custom_facts\n","created":"2024-09-04T13:12:24.978975+01:00","updated":"2024-09-04T13:12:24.978998+01:00","path":"/home/ssh-gateway/ansible/kuly/gather_facts_test1.yaml"}