ansible tutorial

Ansible Tutorial | What is Ansible | Learning Ansible basics

What is Ansible

This ansible tutorial about What is Ansible and Ansible Tutorial for Beginners

Ansible is Open source configuration management and orchestration utility

  •  Automates and standardizes configuration of remote hosts and virtual machines
  •  Coordinates launch and shutdown of multitiered applications
  •  Performs rolling updates of multiple systems with zero downtime
  • Ansible was written by Michael DeHaan and acquired by Red Hat in 2015
  • It run on both configure Unix-like systems as well as Microsoft Windows
  • Creator of Cobbler provisioning application
  • System administrators find it very simple to use
  • Developers can learn it easily
  • Ansible is written in Python, but you can write modules in any language
  • Supported by DevOps tools such as Vagrant and Jenkins

You can also visity the below topics.

What is Ansible Configuration Files Explained with Examples
How to install ansible on centos 7 | Ansible Lab Setup

ansible tutorial
ansible tutorial

Ansible Range

  • Insufficient User Interface
  • Cannot audit changes made by other users on system
  • Example: Cannot determine who made change to a file
  • Does not perform initial minimal installation of system
  • Start with minimal installation via Kickstart or base cloud starter image
  • Then use Ansible to add packages and do configuration
  • Can remediate it
  • Does not track changes made to files on system
  • Does not track which user or process made changes
  • Limited Windows Support
  • To track changes, use version control system or Linux Auditing System


  • Two types of machines in Ansible architecture: control node and managed hosts
  • Ansible software installed and maintained on control node
  • Managed hosts listed in host inventory
  • Text file on control node with managed host names or IP addresses
  • System administrators log in to control node and launch Ansible
  • Specify playbook
  • Specify target host to manage: single system, group of hosts, or wild card
  • SSH used as network transport to communicate with managed hosts
  • Modules referenced in playbook copied to managed hosts
  • Modules execute in order with arguments specified in playbook
  • Core modules perform most system administration tasks
  • Users can write custom modules

Ansible Component

Ansible configuration

    • Defines how Ansible behaves. Settings include:
    • Remote user for command execution
    • Passwords for executing remote commands with sudo
    • To override default values, use environment variables or values defined in configuration files

Host inventory

    • Defines configuration groups to which hosts belong
    • Defines how Ansible communicates with managed host
    • Defines host and group variable values

Core modules

    • Programs copied to managed hosts to perform work for Ansible
    • Over 400 core modules built in

Control Node Role

  • System administrators log in and initiate Ansible operations from control node
  • Ansible software installed and configuration files maintained on control node
  • Other names for control node: Ansible host and control machine

Control Node Requirements

  • Must have Python 2.6 or 2.7 installed
  • Includes Linux, macOS, any UNIX system
  • Windows not currently supported for control node
  • On Red Hat Enterprise Linux 6 or 7, ansible package and dependencies must be installed

Managed Host Role

  • Ansible does the following on managed host systems:
    • Logs in
    • Installs modules
    • Executes remote commands for configuration
    • Other names for managed host: managed node and remote node

Managed Host Requirements

  • SSH must be installed and configured
  • Allows incoming connections and communication with managed hosts
  • Python 2.4 or later
  • Lets you use Ansible to manage Red Hat Enterprise Linux 5, 6, and 7 hosts
  • python-simplejson package must be installed on Red Hat Enterprise Linux 5 managed hosts
  • Not required on Red Hat Enterprise Linux 6 and 7 managed hosts
  • Python 2.5 and newer versions provide functionality by default

Ansible Use Cases Steps

Configuration management

  • Deploy and manipulate remote host’s configuration files
  • Use static files or create files on fly using templates

Multi-node deployment tool

  • Use playbooks to define applications installed and configured on remote machines
  • Apply playbook to multiple machines, building them in consistent manner
  • Orchestrate multi-node applications with Ansible rules

Remote task execution

  • Example: Specify ad hoc commands on command line
  • Causes Ansible to execute commands on remote hosts

Ansible Deployments

  • Ansible strength: Simplifies software configuration of servers
  • When Ansible accesses managed hosts, it can discover version of Red Hat Enterprise Linux running on remote server
  • Ansible determines if host is properly entitled by comparing installed applications and applied software subscriptions
  • Ansible Playbooks can consistently build development, test, and production servers
  • Kickstart can get bare-metal servers running
  • Ansible builds them further
  • Provision servers to corporate baseline standard or specific role within datacenter


Related Posts

Leave a Reply

Your email address will not be published.