{"id":3899,"sha1":"beeaf4b004c5e16eff5023f4bb3c2902777eda1b","playbook":{"id":1958,"items":{"plays":2,"tasks":2,"results":2,"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":["test_zulip.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-15T07:44:29.084872+01:00","ended":"2024-09-15T07:44:30.282560+01:00","duration":"00:00:01.197688","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/test_zulip.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Test plesk on host\n  hosts: all\n  tasks:\n    - name: Check if the binary exists on the remote host\n      test_z:\n        binary_path: \"/sbin/plesk\"\n      register: plesk_check_result\n\n    - name: Aggregate binary check results\n      ansible.builtin.set_fact:\n        plesk_found_on_hosts: \"{{ plesk_found_on_hosts | default([]) + [inventory_hostname] }}\"\n      when: plesk_check_result.binary_exists | bool\n\n- name: Send message\n  hosts: localhost\n  connection: local\n  gather_facts: false\n  vars_files:\n    - zulip_vars.yml\n  tasks:\n    - name: Gather hosts where Plesk was found\n      ansible.builtin.set_fact:\n        remote_hosts_with_plesk: \"{{ groups['all'] | select('match', hostvars[item].plesk_found_on_hosts is defined) | list }}\"\n      loop: \"{{ groups['all'] }}\"\n\n    - name: Send notification to Zulip if binary exists on any remote host\n      when: remote_hosts_with_plesk | length > 0\n      block:\n        - name: Notify about the found binary using apprise\n          ansible.builtin.command: >\n            apprise zulip://{{ bot_name }}@{{ zulip_url }}/{{ zulip_token }}/{{ zulip_topic }}\n                    -t \"Plesk Binary Status\"\n                    -b \"Binary found on the following hosts: {{ remote_hosts_with_plesk | join(', ') }}\"\n          changed_when: false\n","created":"2024-09-15T07:44:29.108082+01:00","updated":"2024-09-15T07:44:29.108101+01:00","path":"/home/ssh-gateway/ansible/kuly/test_zulip.yaml"}