Tutorial by Vinod Kumat

Ansible installation in REHL6 with --version example


What is Ansible?

Ansible is Infrastructure Management and Deployment tools. Ansible can deploy the same configuration to a server over and over again without making any changes after the first deployment.

Ansible aims to be:


1. Clear - Ansible uses a simple syntax (YAML) and is easy for anyone (developers, sysadmins,
managers) to understand. APIs are simple and sensible.
2. Fast - Fast to learn, fast to set up—especially considering you don’t need to install extra agents
or daemons on all your servers!
3. Complete - Ansible does three things in one, and does them very well. Ansible’s ‘batteries
included’ approach means you have everything you need in one complete package.
4. Efficient - No extra software on your servers means more resources for your applications.
Also, since Ansible modules work via JSON, you can easily extend Ansible with modules in
a programming language you already know.

5. Secure - Ansible uses SSH, and requires no extra open ports or potentially-vulnerable daemons on your servers.


Installing Ansible (REHL6)

Following component are required for installing the Ansible:

curl

python (2.6.x) +

python-crypto

python-openssl

python-paramiko

python-setuptools

git (1.7.x)

Followed by ssh installed in same server +

Download and install separately PyYAML and Jinja2 separately, as they're not available via installer:

Download PyYAML:
curl -O https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz

Download Jinja2:
curl -O https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.6.tar.gz

Untar both downloads:
tar -xvf PyYAML-3.10.tar.gz && tar -xvf Jinja2-2.6.tar.gz

Change directory into each of the expanded folders and run python setup.py install to install each package.

Generate an SSH key for use later: ssh-keygen, then hit enter to skip adding a password until you get back to the command prompt.

Clone ansible from its repository on GitHub:
git clone https://github.com/ansible/ansible /opt/ansible

If you'd like to work from a particular Ansible version (like 1.4.4, current as of this writing), change directory into /opt/ansible and checkout the correct tag: git checkout v1.4.4.

Add the following lines into your .bash_profile

vi .bash_profile

then append five line of code in .bash_profile, press esc then type :wq! And enter

# Ansible settings
ANSIBLE=/opt/ansible
export PATH=$PATH:$ANSIBLE/bin
export PYTHONPATH=$ANSIBLE/lib
export ANSIBLE_LIBRARY=$ANSIBLE/library

At this point, you should be able to run ansible commands (once you restart, or enter source ~/.bash_profile to pick up the settings you just added).

Try ansible --version to display Ansible's version.

Referance from http://ansible.com

1 comment: