Select Page

Automate Your Environment with Ansible

Venkata Vijay | | July 9, 2019

Are you looking to reduce manual work and improve the reliability of your IT environment? Then an automation tool like Ansible may be the answer. Learn how you can eliminate repetitive tasks with this open-source automation engine.

Features of Ansible:

It is an agentless, secure, provisioning and deployment tool that is easy to start, data-driven, and idempotent.

Agentless: Ansible uses an open sshd and WinRM protocol to automate your environment. No additional agents need to be installed and firewall ports need to open. It is very secure to use.

Provisioning and Deployment: From the management node you can provision and deploy to the remote nodes. There are two things that will play a major role on ansible:

1) Playbooks
2) Host inventory file

We have developed a playbook on the management node and can execute that playbook to perform deployments in the remote nodes.

In the Host inventory file, you need to define the remote nodes and then need to execute the playbooks. These playbooks are very easy to use.

Data-driven: Whatever the information you keep in the playbook is used to perform the deployment.

Idempotent: Retains the state of affairs going on the remote node.

For example: if there are 5 steps needed to be executed in the remote node and for some reason Ansible fails at step 3; if you re-run it again it will leave the previous 3 steps and execute from steps 4 & 5 which will save some time.

For one of our clients, we used Ansible to do patching and package installation. This helped them save a lot of manual effort. With the help of below YAML script, we can automate the patching activity for X no. of hosts which can save a huge amount of manual effort.

The below script will collect all the system required information with pre and post checks and once the patching completes it will automatically reboot the host with the updated patch and the latest version of the kernel as per the client requirement.

We can easily modify the script to suit any requirement.

YAML  Script

- hosts: all
gather_facts: true
remote_user: support
become: true
become_method: sudo


- name: Pre_Reboot Output
shell: df -Th | grep ^/dev ; route -n ; fdisk  -l | grep ^/dev ; uname -a ; uptime
register: prereboot
- debug: msg={{prereboot.stdout_lines}}

- name: Update OS Packages
update_cache: yes
name: "*"
state: latest
exclude: mysql, mariadb

- name: List Of Installed|Updated Packages
shell: rpm -qa --last | grep "$(date +%a\ %d\ %b\ %Y)" |cut -f 1 -d " "
register: package
- debug: msg="{{package.stdout_lines}}"

- name: Reboot the Server Post Patching
reboot_timeout: 500
test_command: uptime

- name: Wait For the Server To Come UP
connect_timeout: 120
timeout: 250

- name: Post_Reboot Output
shell: uname -a ; uptime
register: postreboot
- debug: msg={{postreboot.stdout_lines}}

How to automate your Environment with Datavail

Need help getting started with Ansible? We have a team of experts who can provide 24x7 support. First, we will run an assessment of your existing environment and provide a plan of action as to how automation can help you reduce manual work and improve the reliability of your IT environment.

Contact us today to learn more.

ORA-12154: TNS:could not resolve the connect identifier specified

Most people will encounter this error when their application tries to connect to an Oracle database service, but it can also be raised by one database instance trying to connect to another database service via a database link.

Jeremiah Wilton | March 4, 2009

Hyperion Myth #9: SOX Audit Requests Are Time-consuming

With serious financial penalties, SOX audits can be intimidating — but they don’t have to be. Find out how you can use Datavail’s software to automatically prove SOX compliance.

Jonathan Berry | March 13, 2018

12c Upgrade Bug with SQL Tuning Advisor

This blog post outlines steps to take on Oracle upgrade 11.2 to 12.1 if you’re having performance problems. Oracle offers a patch and work around to BUG 20540751.

Megan Elphingstone | March 22, 2017

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.


Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.