Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

Ansible

Ansible is an open source IT Configuration


Management, Deployment & Orchestration
tool. It aims to provide large productivity gains
to a wide variety of automation challenges.
This tool is very simple to use yet powerful
enough to automate complex multi-tier IT
application environments.
Ansible fits in the greater in DevOps story, we began
with an overview of DevOps as a methodology.
DevOps is first and foremost a way of bringing
together Development teams, who plan and build
code, with Operations teams, who must release and
deploy that code, while making sure everything works
as it should. If those teams work together, with shared
and efficient practices and tools, they can deliver
projects and then ensure their continuous operation
much faster and with much better accuracy than if they
were working
` IT pros who want to work in DevOps environments
must learn to work with the DevOps tools that matter,
like Docker, Ansible,Chef, Kubernetes and many
others.
` Ansible is one such important tool, which has been
gaining prominence in recent years. Nowadays its
capabilities are much more extensive than it is,
enabling the configuration of network devices,
application deployment and even provisioning cloud-
based infrastructures.
` YAML syntax is very simple, and Ansible is
written in Python but you don’t need to know
Python at all, in order to use it. At the same
time, its features enable the modelling of very
complex IT workflows.
` It is used to create the infrastructure necessary
for the code to run, deploy the application and
then make sure its configuration is maintained
as intended.
Ansible modules are standalone scripts that can be
used inside an Ansible playbook. You can use these
modules to run whatever commands it needs to get
its job done.

Ansible modules are categorized into various groups


based on their functionality. There are thounds of
Ansible modules are available. We have categorized
all the modules as shown in the next page
System
System modules are actions to be performed at a system
level such as modifying the users and groups on the
system, modifying iptables and firewall configurations,
working with logical volume groups, mounting operations
and working with services.
Command
Command module are used to execute command or script
on the host. This could be a simple command using the
command module or an interactive execution using expect
by responding to prompts. You could also run a script on
the host using the script module.
Files
Files module will help in working with files. For example,
using an ACL module to set an acl information on files,
use the archive and unarchive module to compress and
unpack files, use find, lineinfile, and replace the module
to modify the contents of an existing file.
Database
Database module helps in working with databases such
as mongodb, mysql, mssql, postgresql, proxysql and
vertica to add or remove databases or modifying
database configurations, etc.
Cloud
The Cloud section has a vast collection of modules for
different cloud providers like Amazon, Azure, Google,
Docker, VMware, Digital Ocean, Openstack, and many
more. There are number a of modules available of each of
these that allow you to perform various tasks such as,
creating and destroying instances, performing configuration
changes, security, managing containers, clusters, and much
more.
Windows
Windows module helps you in the Windows environment.
Some of them are, Win_copy to copy files, Win_command
to execute a command, configuring a domain, configuring
IIS, configuring registry, and lot more.
The play is the element that ties tasks to the servers
where they'll run. The key element here is the
mandatory keyword hosts. This is the part of Ansible
that tells which hosts are being affected and how.

The playbook is therefore composed of plays, which


are composed of modules.It contains a list of tasks
(plays) in an order they should get executed against
a set of hosts or a single host based on the
configuration specified. Playbooks are written in
YAML, in an easy human-readable syntax
Playbook: the highest level, just a list of plays
Play: ties tasks to host lists
Tasks: definition of a call to a module
Besides tasks, a play may have pre-tasks, post-tasks and
handlers, which are all task-like, and roles.

A role is a different thing, as it is not defined within a


playbook. Instead, they each have their own subdirectory
under the directory roles. The objective of roles is to
organize things. So, under the role's subdir, you can find
tasks, handlers, files and templates, variables and defaults.
All of these related to that specific role.
https://linuxbuz.com/linuxhowto/what-is-ansible-
modules-and-how-to-use-it

You might also like