Hi all,

I would like to receive an email with the hosts that don't have port 22 
(for example) open
How can I do this ?

I though of something like this:
---
- name: check if ssh port is opened
  hosts: ANSIBLE
  tasks:
    - wait_for: port=22 host="{{ item }}" search_regex=OpenSSH delay=1 
timeout=5
      register: output
      with_items: "{{ groups['TRAINING'] }}"
      ignore_errors: true
    - mail:
        host='{{ IP }}'
        port=25
        subject="[ERROR] Ansible-report from the dark side"
        body="{{ output.????? }}"
        from="[email protected] (Ansible)"
        to="[email protected]"
        charset=utf8
      when: output|failed

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2e49953e-a870-4b36-b87a-5633c14e53ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to