Monday 22 February 2016

01.02.Install_ANSIBLE_in_RHEL_or_CentOS

Configure ANSIBLE in RHEL / CentOS 6.X

Reference : http://docs.ansible.com/ansible/intro_installation.html

Step 1 : Clone the ansible repository from GITHUB

$ git clone git://github.com/ansible/ansible.git --recursive
$ cd ./ansible
Step 2 : Setup your environment

Using Bash:
$ source ./hacking/env-setup
Using Fish:
$ . ./hacking/env-setup.fish
If you want to suppress spurious warnings/errors, use:
$ source ./hacking/env-setup -q
Step 3 : Install PIP and Python modules for ANSIBLE
If you don’t have pip installed in your version of Python, install pip:
$ easy_install pip
Ansible also uses the following Python modules that need to be installed :
$ pip install paramiko PyYAML Jinja2 httplib2 six
Note when updating ansible, be sure to not only update the source tree, but also the “submodules” in git which point at Ansible’s own modules (not the same kind of modules, alas).

$ git pull --rebase
$ git submodule update --init --recursive
Once running the env-setup script you’ll be running from checkout and the default inventory file will be /etc/ansible/hosts. You can optionally specify an inventory file (see Inventory) other than /etc/ansible/hosts:
$ echo "127.0.0.1" > ~/ansible_hosts
$ export ANSIBLE_INVENTORY=~/ansible_hosts

01.01.Install_Ansible_on_Ubuntu

ANSIBLE on UBUNTU

Step 1 : Install
Here we'll use the ppa:ansible/ansible repository as it is easy to remember.

# apt-get-repository -y ppa:ansible/ansible
# apt-get update
# apt-get install -y ansible
Step 2 : Managing Servers
Ansible has a default inventory file used to define which servers it will be managing. After installation, there's an example one you can reference at /etc/ansible/hosts. I usually copy and move the default one so I can reference it later:

# mv /etc/ansible/hosts /etc/ansible/hosts.orig
Then I create my own inventory file from scratch. 
After moving the example inventory file, create a new /etc/ansible/hosts file, and define some servers to manage.  Here's we'll define two servers under the "web" label:

[web]
192.168.1.50
192.168.1.51
For testing this article, I created a virtual machine, installed Ansible, and then ran Ansible Tasks directly on that server. To do this, my hosts inventory file simply looked like this:

[local]
127.0.0.1
Step 3 : Setup your SSH keys. Follow the link to setup your SSH keys

https://github.com/vmsnivas/ssh-keys/blob/master/01.%20Configuring%20SSH%20keys.txt