{"id":5128,"sha1":"0392696f8303285a0e25b86f64820b46fb92c413","playbook":{"id":3022,"items":{"plays":1,"tasks":4,"results":4,"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/hosts"],"listhosts":false,"subset":null,"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":["generate_inventory_from_files.yml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"}],"started":"2025-05-23T14:00:29.009207+01:00","ended":"2025-05-23T14:00:31.119599+01:00","duration":"00:00:02.110392","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/generate_inventory_from_files.yml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Generate Ansible inventory from fetched .ini files\n  hosts: localhost\n  gather_facts: false\n  vars:\n    base_dir: \"fetched_files\"\n    output_inventory_file: \"generated_inventory.ini\"\n\n  tasks:\n    - name: Find all .ini files under each host folder\n      ansible.builtin.find:\n        paths: \"{{ base_dir }}\"\n        patterns: \"*.ini\"\n        recurse: true\n      register: ini_files\n\n    - name: Debug - show how many files found\n      ansible.builtin.debug:\n        msg: \"Found {{ ini_files.files | length }} .ini files.\"\n\n    - name: Extract hostnames from filenames\n      ansible.builtin.set_fact:\n        hosts_list: >-\n          {{\n            ini_files.files |\n            map(attribute='path') |\n            map('basename') |\n            map('regex_replace', '-panel.ini$', '') |\n            list\n          }}\n\n    - name: Write inventory to file\n      ansible.builtin.template:\n        src: inventory_template.j2\n        dest: \"{{ output_inventory_file }}\"\n        mode: 0644\n","created":"2025-05-23T14:00:29.022677+01:00","updated":"2025-05-23T14:00:29.022703+01:00","path":"/home/ssh-gateway/ansible/kuly/generate_inventory_from_files.yml"}