0% found this document useful (0 votes)
109 views4 pages

Ansible

1. Ansible is a configuration management tool that uses YAML files and SSH to run commands on remote machines without installing any additional software. 2. It was created in 2012 and has grown popular due to its simplicity and ability to manage configurations without running daemons. 3. The document describes how to install Ansible from source or by building Debian and RPM packages on Linux systems like Debian and Red Hat. Building packages makes uninstalling easier than installing from source.

Uploaded by

mohit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
109 views4 pages

Ansible

1. Ansible is a configuration management tool that uses YAML files and SSH to run commands on remote machines without installing any additional software. 2. It was created in 2012 and has grown popular due to its simplicity and ability to manage configurations without running daemons. 3. The document describes how to install Ansible from source or by building Debian and RPM packages on Linux systems like Debian and Red Hat. Building packages makes uninstalling easier than installing from source.

Uploaded by

mohit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 4

Ansible

Playbook: A playbook is a text file that contains instructions for Ansible to follow to ensure that
the machine against which you’ve run Ansible is in the correct state.

About Ansible:
Ansible was first released by Michael DeHaan in 2012 as a small side project, and it has had a
meteoric rise in popularity, with over 17,000 stars and 1,410 unique contributors on Github.
Stars on Github are a way to follow the progress of a project that you’re interested in, but
aren’t necessarily contributing code to. Beyond being a successful open-source project, it has
been successfully used in enterprise by companies like Apple and NASA, who rely on it for their
configuration management needs.
Ansible uses YAML files as its main source of information at run time. YAML is a data
representation language that is commonly used for configuration.
Ansible is written entirely in Python. The main runner and all of the modules are Python 2.6
compatible, which means that they’ll work with any version of Python2 above version 2.6.

Ansible works by running commands via SSH, so there’s no need to install any server software.
This is a huge plus for two reasons :
1. Your machines run your application without any CPU or memory-hungry daemons running
in the background.
2. You get everything that SSH provides for free. You can use advanced features, such as
ControlPersist, Kerberos, and jump hosts. In addition, there is no need to roll your own
authentication mechanism — you can let SSH take care of it for you!

Ansible more closely resembles a tool called SaltStack (Salt), which also uses YAML files for
configuration and is also written in Python. Both Ansible and Salt are built primarily as
execution engines, where your system definition is just a list of commands to run, abstracted
behind reusable modules that provide an idempotent interface to your servers.
Ansible on Debian:
Installing from Source :
The easiest way to get the most up-to-date version of Ansible available is to install it from
source. To build Ansible, you’ll need to start by installing some development packages on your
machine. Once you’ve installed the required packages, you’ll clone Ansible’s source code from
Github and use its makefile to install Ansible onto your machine. Here are all of the
commands required to install Ansible from source on a Debian-based machine :
sudo apt-get update
sudo apt-get install build-essential git python-pip python-dev libffi-dev libssl-dev
sudo pip install setuptools --upgrade
git clone git://github.com/ansible/ansible.git --recursive
cd ansible
make
sudo make install
Building a .deb Package :
While installing from source installs the latest version of Ansible, it makes uninstalling Ansible
quite difficult. As Ansible simply copies files into the correct directory when installing from
source, nothing tracks which files were created (and so it doesn’t know which files to remove).
By building a Debian package (a .deb file), you can utilize all of the same installation and
removal tools that standard system packages use. Building a .deb file from the Ansible source
code requires all of the same dependencies as installing from source, as well as some system
packages that are required to build your .deb package. The following commands will install all
of the required packages and build a Debian package that you can use to install Ansible.
sudo apt-get update
sudo apt-get install build-essential git python-pip python-dev libffi-dev libssl-dev asciidoc
devscripts debhelper cdbs
sudo pip install setuptools --upgrade
git clone git://github.com/ansible/ansible.git --recursive
cd ansible
make deb
Once the make deb command completes, you can locate your built Debian package with the
following command:
$ find . -name "*.deb"
./deb-build/unstable/ansible_2.2.0-0.git201607051907.d0ccedc.devel~unstable_all.deb
Before you can install this package, you’ll need to install a few dependencies that Ansible needs
by running the following command:
sudo apt-get install python-jinja2 python-paramiko sshpass python- markupsafe
Once you’ve got all of the dependencies you need installed, you can install Ansible from the
Debian package you just built:
$ sudo dpkg -i ./deb-build/unstable/ansible_2.2.0-0.git201607051907.d0ccedc.
devel~unstable_all.deb
At this point, you can run ansible --version to prove that Ansible is installed. Because you
built a package for Ansible, if you ever decide that you want to uninstall it, it’s as simple as
running sudo apt-get remove ansible .
Ansible on RedHat :
Installing from Source:
sudo yum install epel-release
sudo yum clean all
sudo yum install git gcc python-pip python-devel libffi-devel openssl-devel
sudo pip install setuptools --upgrade
git clone git://github.com/ansible/ansible.git --recursive
cd ansible
make
sudo make install
Building a .rpm Package :
As on Debian, installing Ansible from source makes uninstalling it quite difficult. By building an
RPM (RedHat Package Management ) file, you can utilize all of the same installation and
removal tools that standard system packages use. Building an RPM from the Ansible source
code requires all of the same dependencies as installing from source, as well as some system
packages that are required to build your RPM package. The following commands will install all
of the required packages and build a RPM package that you can use to install Ansible:
sudo yum install epel-release
sudo yum clean all
sudo yum install git gcc python-pip python-devel libffi-devel openssl-devel asciidoc rpm-build
sudo pip install setuptools --upgrade
git clone git://github.com/ansible/ansible.git --recursive
cd ansible
make rpm
Once the make rpm command completes, you can locate your built RPM package with the
following command:
$ find . -name "*noarch.rpm"
./rpm-build/ansible-2.2.0-0.git201607051907.d0ccedc.devel.el7.centos.noarch.rpm
Once you have this, you can install your newly-built RPM using yum :
sudo yum install ./rpm-build/ansible-2.2.0-0.git201607051907.d0ccedc.devel.
el7.centos.noarch.rpm
At this point, you can run ansible --version to prove that Ansible is installed. Because you
built a package for Ansible, if you ever decide that you want to uninstall it, it’s as simple as
running sudo yum remove ansible .

You might also like