{"id":2765,"sha1":"0262021031bc11565759e97b2cf90ce309030dd7","playbook":{"id":1642,"items":{"plays":2,"tasks":6,"results":551,"hosts":139,"files":6,"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":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":["create1.yaml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"}],"started":"2024-09-11T09:31:48.770586+01:00","ended":"2024-09-11T09:33:14.793797+01:00","duration":"00:01:26.023211","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/create1.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Delete file if exists and create header\n  hosts: localhost\n  gather_facts: false\n  vars:\n    inv_file: /home/ssh-gateway/ansible/kuly/canary-inventory\n  tasks:\n    - name: Delete inventory file if it exists\n      ansible.builtin.file:\n        path: \"{{ inv_file }}\"\n        state: absent\n      run_once: true\n    - name: Create file and header\n      ansible.builtin.lineinfile:\n        path: \"{{ inv_file }}\"\n        line: \"[canary]\\n\"\n        create: true\n        mode: '0644'\n      run_once: true\n\n- name: Collect and select Plesk hosts\n  hosts: all\n  gather_facts: true\n  roles:\n    - plesk\n  tasks:\n    - name: Gather hosts\n      when: plesk_found\n      ansible.builtin.set_fact:\n        plesk_hosts: \"{{ groups['all'] | selectattr('plesk_found', 'defined') | selectattr('plesk_found', 'equalto', true) | map(attribute='inventory_hostname') | list }}\"\n    - name: Select 10 random Plesk hosts\n      ansible.builtin.set_fact:\n        random_plesk_hosts: \"{{ plesk_hosts | random(10) }}\"\n\n    - name: Store random Plesk hosts in a local variable\n      ansible.builtin.add_host:\n        name: \"{{ item }}\"\n        groups: canary\n      with_items: \"{{ random_plesk_hosts }}\"\n      delegate_to: localhost\n    - name: Debug plesk_hosts\n      ansible.builtin.debug:\n        msg: \"{{ plesk_hosts }}\"\n    - name: Debug random_plesk_hosts\n      ansible.builtin.debug:\n        msg: \"{{ random_plesk_hosts }}\"\n\n- name: Add selected Plesk hosts to inventory\n  hosts: localhost\n  gather_facts: false\n  vars:\n    inv_file: /home/ssh-gateway/ansible/kuly/canary-inventory\n  tasks:\n    - name: Add selected Plesk hosts to inventory file\n      ansible.builtin.lineinfile:\n        path: \"{{ inv_file }}\"\n        line: \"{{ item }}\"\n        insertafter: \"[canary]\"\n      with_items: \"{{ hostvars['localhost']['groups']['canary'] }}\"\n      run_once: true\n\n- name: Add footer\n  hosts: localhost\n  gather_facts: false\n  vars:\n    inv_file: /home/ssh-gateway/ansible/kuly/canary-inventory\n  tasks:\n    - name: Add vars\n      ansible.builtin.lineinfile:\n        path: \"{{ inv_file }}\"\n        line: |\n          [canary:vars]\n          ansible_user=root\n          ansible_port=2233\n        insertafter: EOF\n      run_once: true\n","created":"2024-09-11T09:31:48.788145+01:00","updated":"2024-09-11T09:31:48.788169+01:00","path":"/home/ssh-gateway/ansible/kuly/create1.yaml"}