{"id":3902,"sha1":"56f62603be35ec9d5a8305d539b52ce279ab9562","playbook":{"id":1961,"items":{"plays":1,"tasks":7,"results":7,"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/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":10,"module_path":null,"syntax":false,"listtasks":false,"listtags":false,"step":false,"start_at_task":null,"args":["create_inventory_from_solus.yaml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"},{"id":122,"name":"solus"},{"id":123,"name":"playbook"},{"id":124,"name":"create"},{"id":125,"name":"inventory"}],"started":"2024-09-16T10:09:25.199046+01:00","ended":"2024-09-16T10:09:28.926548+01:00","duration":"00:00:03.727502","name":"create inventory","ansible_version":"2.16.11","client_version":"1.7.2","python_version":"3.10.10","server_version":"1.7.2","status":"failed","path":"/home/ssh-gateway/ansible/kuly/solus_old/create_inventory_from_solus.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- hosts: localhost\n  gather_facts: false\n  vars:\n    ara_playbook_name: create inventory\n    ara_playbook_labels:\n      - solus\n      - playbook\n      - create\n      - inventory\n    folder: /home/ssh-gateway/ansible/kuly\n    file: crs.json\n    inventory: computeresources_inv.ini\n\n  tasks:\n\n    - name: Get the json\n      ansible.builtin.uri:\n        url: https://solus.stage.town/api/v1/compute_resources\n        method: GET\n        headers:\n          Content-Type: application/json\n          Authorization: \"{{ lookup('file','auth_bear') }}\"\n        follow_redirects: safe\n        return_content: true\n        status_code: 200\n      register: result\n\n    - name: Delete json file first\n      tags:\n        - delete_file\n      ansible.builtin.file:\n        path: \"{{ folder }}/{{ file }}\"\n        state: absent\n\n    - name: Delete the old inventory\n      ansible.builtin.file:\n        path: \"{{ folder }}/{{ inventory }}\"\n        state: absent\n\n    - name: Save to file the json\n      tags:\n        - save\n      ansible.builtin.lineinfile:\n        create: true\n        path: \"{{ folder }}/{{ file }}\"\n        mode: 0640\n        line: \"{{ result.json | to_nice_json }}\"\n      delegate_to: 127.0.0.1\n\n    - name: Generate header\n      ansible.builtin.copy:\n        dest: \"{{ folder }}/{{ inventory }}\"\n        content: |\n          [compute_resources]\n        mode: 0640\n        owner: root\n\n    - name: Read the file\n      ansible.builtin.include_vars: \"{{ folder }}/{{ file }}\"\n\n    - name: Add hosts\n      ansible.builtin.lineinfile:\n        path: \"{{ folder }}/{{ inventory }}\"\n        line: \"{{ item }} ansible_host={{ item }} ansible_port=2233\"\n        create: true\n        mode: 0640\n      delegate_to: 127.0.0.1\n      loop: \"{{ json.data | dict2items }}\"\n","created":"2024-09-16T10:09:25.218539+01:00","updated":"2024-09-16T10:09:25.218559+01:00","path":"/home/ssh-gateway/ansible/kuly/solus_old/create_inventory_from_solus.yaml"}