Skip to content

Instantly share code, notes, and snippets.

@bradynathan
Created May 19, 2017 20:54
Show Gist options
  • Save bradynathan/8b705e232750500f83118e1cbf65f0b5 to your computer and use it in GitHub Desktop.
Save bradynathan/8b705e232750500f83118e1cbf65f0b5 to your computer and use it in GitHub Desktop.
---
- name: Use openssl to verify system rebooted
local_action: shell openssl s_client -connect {{ ansible_host }}:{{ ansible_port| default(22) }}
become: false
ignore_errors: True
register: openssl_test_result
changed_when: False
- name: Email notification if server is not reachable
local_action: >
mail to="{{ item }}" subject="{{ ansible_hostname }} UNREACHABLE" body='The system is unreachable after updates'
become: false
with_items:
- "{{ updates_failure_notification }}"
when: openssl_test_result.stderr.find('Connection refused') > -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment