Ansible installation in REHL6 Unix

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:

python (2.6.x) +
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

Download Jinja2:
curl -O

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 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 /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
export PATH=$PATH:$ANSIBLE/bin

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


Book: Ansible for DevOps  by Jeff Geerling

No comments:

Post a Comment

Please provide your input, it will honer for me...