{"id":5109,"sha1":"0d0bc5a9f03f8d1dbafcf65420f95c62b0366035","playbook":{"id":3003,"items":{"plays":1,"tasks":6,"results":6,"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/generated_inventory.ini"],"listhosts":false,"subset":"vibrant-cricket.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":["upload_ini_to_hosts.yml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"},{"id":191,"name":"subset:vibrant-cricket.man-1.vm.plesk-server.com"}],"started":"2025-05-23T11:28:58.840835+01:00","ended":"2025-05-23T11:29:02.870484+01:00","duration":"00:00:04.029649","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/upload_ini_to_hosts.yml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Upload panel.ini files to each host in generated inventory\n  hosts: all\n  gather_facts: false\n  vars:\n    local_file_dir: \"fetched_files\"\n    remote_dest_path: \"/usr/local/psa/admin/conf/panel.ini\"\n\n  tasks:\n    - name: Show current working directory\n      ansible.builtin.shell: pwd\n      register: current_pwd\n      delegate_to: localhost\n      run_once: true\n\n    - name: Debug - current working directory\n      ansible.builtin.debug:\n        msg: \"Current working directory: {{ current_pwd.stdout }}\"\n\n    - name: Find matching ini file in local directories\n      ansible.builtin.find:\n        paths: \"{{ local_file_dir }}\"\n        patterns: \"{{ inventory_hostname }}-panel.ini\"\n        recurse: true\n      register: found_ini_files\n      delegate_to: localhost\n      run_once: true\n\n    - name: Debug - list all matched files\n      ansible.builtin.debug:\n        msg: \"Matched files: {{ found_ini_files.files | map(attribute='path') | list }}\"\n\n    - name: Fail if no matching .ini file is found\n      ansible.builtin.assert:\n        that:\n          - found_ini_files.files | length == 1\n        fail_msg: \"Expected exactly one matching .ini file for {{ inventory_hostname }} but found {{ found_ini_files.files | length }}.\"\n\n    - name: Upload the matched .ini file to the remote host\n      ansible.builtin.copy:\n        src: \"{{ found_ini_files.files[0].path }}\"\n        dest: \"{{ remote_dest_path }}\"\n        mode: '0644'\n        owner: root\n        group: root\n        force: true\n      notify: Show success message\n\n  handlers:\n    - name: Show success message\n      ansible.builtin.debug:\n        msg: \"Uploaded {{ found_ini_files.files[0].path }} to {{ inventory_hostname }} at {{ remote_dest_path }}\"\n","created":"2025-05-23T11:28:58.864940+01:00","updated":"2025-05-23T11:28:58.864961+01:00","path":"/home/ssh-gateway/ansible/kuly/upload_ini_to_hosts.yml"}