Posts

Showing posts with the label Ansible playbook

Ansible 4: Reboot remote servers

Image
Hello DevOps enthusiasts! Here I came up with new learning on the automations with Ansible reboot module on a VM/Linux server. This is a most common requirement for most DevOps projects having the dev, test, stage, production environments, when there is Operating System patching happens on a VM, there could be a need for the reboot of that VM Ansible reboot module and its parameters There are reboot strategy is most important in how you handle the box before reboot and after reboot. You must aware of all the manual processes that will be required to start after reboot. During the reboot select the proper timeout in seconds. If "systemd" started as a service you can check the major/important service status to show it as 'active' Pre-requisites To execute the following experiment you must have the following setup: Ansible Controller Managed nodes (multiple) defined in the inventory and accessible for running playbooks Ansible playbook for reboot VM In this example playb...

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-...