Posts

Showing posts with the label Ansible playbook

Ansible Reboot Module: Automate Linux Reboots after patching

Image
Hello DevOps enthusiasts!  Welcome back to another hands-on automation experiment. In this article, we will explore how to use the Ansible reboot module to automate Linux VM/server reboots . A server reboot is a very common requirement in enterprise DevOps environments. When Operating System (OS) patching or kernel updates are performed across Development, Test, Stage, and Production environments , a reboot may be required for the changes to take effect. Instead of manually logging into each server, rebooting it, waiting for it to become available, and then checking whether important services are running, we can automate the entire workflow using Ansible. This article demonstrates a simple but practical pre-reboot → reboot → post-reboot validation approach. What We'll Learn By the end of this article, you will understand how to: Use the Ansible reboot module Automate Linux VM/server reboots Configure reboot_timeout Perform post-reboot validation Check server uptime after reboot ...

Ansible 2: Ad-hoc commands and Getting start Writing a Playbook

Image
Overview of Ansible PLAYBOOK  An Ansible playbook is a single YAML file that contains multiple plays.  Each Play will be defined with a set of activities that are treated as tasks,  and these tasks can be executed at the remote host that is the Ansible client. The task can be a single action that can be one of:   Execute a command    Run a script    install patch or package   Reboot VM/box    Restart services Simple ansible play can be  check the timestamp reboot server wait for connect back check the uptime  check timestamp  Complex ansible play Take a backup of files on 20 DB VMs Deploy application on 100 App boxes 100 servers patch apply 100 VM reboot after patch  Mail and slack notifications on patch process  Ansible ad-hoc command When you plan to write a playbook first you need to test the ad-hoc commands as trial and error will gives more confidence to run in a play # Ansible ad-...