A JVM service OOM-crashed every 4h; the fleet-wide fix was rolled out in seconds with one ad-hoc `ansible -m shell` command. Root cause: JVM heap equal to the container limit left no overhead → kernel OOM. The fix: Push the heap fix fleet-wide with an ad-hoc command: `ansible all -m shell -a 'sed -i ... -Xmx3g'` (no playbook needed).
A production war story from the TheCodeForge Ansible series — the incident, why it happened, and the exact fix.
⏳ Timestamps:
0:00 - Cold open: crashed every 4 hours
0:14 - Intro
0:21 - What Is Ad-Hoc?
0:35 - Anatomy of Command
1:00 - Shell vs Command
1:20 - Become for Root
1:40 - Copy Module
2:02 - Setup Module Facts
2:24 - Package Module
2:44 - Verbosity & Check Mode
3:06 - Patterns & Limits
3:22 - crashed every 4 hours
3:45 - JVM memory limit too high
3:57 - The Fix
4:18 - ⚠ Gotcha: Setting -Xmx equal to container limit
4:33 - ⚠ Gotcha: Running ansible all without --limit
4:45 - ⚠ Gotcha: Double-escaping quotes and special characters
4:59 - ⚠ Gotcha: Running privileged commands without --become
5:07 - ⚠ Gotcha: Overwriting config without backup=yes
5:19 - ⚠ Gotcha: Assuming same package name across distros
5:35 - Version Compatibility: Module Names
6:10 - Production Caveat: Parallelism and Forks
6:48 - Debugging Guide
7:05 - Interview Questions
7:29 - FAQ
7:46 - Key Takeaways
7:58 - Next up
8:11 - Wrap-up
👉 Full article + code: https://thecodeforge.io/devops/ansibl...
⏭ Next up: Your First Ansible Playbook
#ansible #devops #automation