Installing ansible on Centos 6

h3. Installing ansible on Centos 6

h5. ansible  dependencies

* python-babel
* PyYAML    
* python-crypto      
* python-jinja2      
* python-paramiko
* python-simplejson.x86_64 – on all nodes ( if python is lower version than 2.5 )

{code}
[root@tiber07vm1 ansible]# ansible –version
ansible 1.1
{code}

h5. Control Machine (master ) Requirements :

Currently Ansible can be from any machine with Python 2.6 installed

[root@tiber07vm1 download]# python -V
Python 2.6.6

h5. Managed Node Requirements
On the managed nodes, you only need Python 2.4 or later, but if you are are running less than Python 2.5 on the remotes, you will also need:

h5. Inventory of manged hosts:

Inventory of manged hosts will be at /etc/ansible/hosts

{code}
[root@tiber07vm1 ansible]# cat /etc/ansible/hosts
[local]
tiber07vm1

[remote]
tiber07vm3

[all:children]
local
remote

{code}

h5. First run :

{code}
[root@tiber07vm1 ansible]# ansible remote1  -a “uptime” –ask-pass
SSH password:
tiber07vm4 | success | rc=0 >>
 23:27:18 up 20 days, 11:05,  0 users,  load average: 0.00, 0.00, 0.00

{code}

h5. SSH trust : since you want pass wordless authentication from your master machine ,its advisable to establish a trust

{code}

ssh-copy-id tiber07vm1

ssh-copy-id tiber07vm3

{code}

h5. Sample run :

{code}

[root@tiber07vm1 ansible]# ansible local -a “uptime”
tiber07vm1 | success | rc=0 >>
 23:32:56 up 20 days, 11:10,  1 user,  load average: 0.04, 0.02, 0.00

[root@tiber07vm1 ansible]# ansible remote  -a “uptime”
tiber07vm3 | success | rc=0 >>
 23:33:01 up 20 days, 11:10,  0 users,  load average: 0.04, 0.02, 0.00

[root@tiber07vm1 ansible]# ansible all -a “uptime”
tiber07vm1 | success | rc=0 >>
 23:33:06 up 20 days, 11:11,  1 user,  load average: 0.03, 0.02, 0.00

tiber07vm3 | success | rc=0 >>
 23:33:07 up 20 days, 11:11,  0 users,  load average: 0.03, 0.02, 0.00

{code}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s