Skip to content

Instantly share code, notes, and snippets.

@gkspranger
Created February 17, 2017 21:00
Show Gist options
  • Save gkspranger/47319bab78a487c58ef1cd21080e5a63 to your computer and use it in GitHub Desktop.
Save gkspranger/47319bab78a487c58ef1cd21080e5a63 to your computer and use it in GitHub Desktop.
---
# ansible-playbook -i inventories/ec2.py adhoc/aem_thread_dump.yml --limit aem-author.example.com
# tag_role_aem is what our AWS EC2 AEM nodes are tagged with .. tag:role=aem
# the --limit <node name> is the name of the node you want to run the thread dump helper on
- hosts: tag_role_aem
max_fail_percentage: 1
vars:
email_to:
- yo@yo.ma
- ma@ma.yo
email_from: "noreply@example.com"
become: True
tasks:
- name: get date
shell: date +"%Y_%m_%d_%H_%m_%S"
register: pretty_date
- name: run AEM thread dump
shell: |
/home/day/bin/thread_dump_helper.sh
cd /home/day/{{ aem_type }}/crx-quickstart/logs/
rm -fr threaddump.{{ inventory_hostname }}.zip
zip threaddump.{{ inventory_hostname }}.zip threaddump.log
become_user: day
ignore_errors: True
- name: email thread dump files
mail: >
from="{{ email_from }}"
to="{{ email_to | join(',') }}"
subject="AEM Thread Dump of {{ inventory_hostname }} was created on {{ pretty_date.stdout }}"
body="Attached is the thread dump of {{ inventory_hostname }} created on {{ pretty_date.stdout }}"
attach="/home/day/{{ aem_type }}/crx-quickstart/logs/threaddump.{{ inventory_hostname }}.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment