May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Ansible centos 6

Ansible is a configuration management tool, deployment tool, and ad-hoc task execution tool all in one.

It requires no daemons or any other software to start managing remote machines — it works using SSHd (using paramiko, to make it smoother), which is something nearly everyone is running already. Because it’s using SSH, it should easily pass a security audit and be usable in places that would be resistant to running a root-level daemon with a custom PKI infrastructure. Best of all, you should probably be able to completely understand most of Ansible in about 20-30 minutes. Hopefully less.

I also wanted to make Ansible maximally extensible. Ansible modules can be written in any language — not just Ruby or Python, but any language capable of returning JSON or key=value text pairs. Bash or Perl is fine! In this way, Ansible manages to sidestep most of the popular Python vs Ruby language wars entirely, and should be of interest to people who like both — or neither.

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@rmohanserver 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@rmohanserver 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@rmohanserver ansible]# cat /etc/ansible/hosts
[local]
rmohanserver

[remote]
rmohan1

[all:children]
local
remote

{code}

h5. First run :

{code}
[root@rmohanserver ansible]# ansible remote1 -a “uptime” –ask-pass
SSH password:
rmohan1 | 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 rmohanserver

ssh-copy-id rmohan1

{code}

h5. Sample run :

{code}

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

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

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

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

Try to use the configuration management tool Ansible is a continuation of.
Let’s summarize what was examined Playbook this time. Playbook subject by a combination of processing using modules of Ansible server is that describes the structure of the. For example, Apache if you are building a Web server using, simply yum Apache on Install never to completing, then, a series or set properly the contents of the httpd.conf Then, like, or open the port in iptables There is work, but that it must be defined as Playbook together the work for such a server configured you will be able to leave as a “instructions that can be executed”. Puppet becomes equivalent manifest in the sense of, the recipe in the Chef. Format Playbook of Ansible is YAML so, you can start writing feel free.

Simple Playbook

First from yum simply MySQL I try to create a Playbook only to install.

mysql.yml

– hosts : all
user : root
Tasks :
– name : install mysql
yum : name = mysql = installed State

To run the Playbook that you created, and then run the command ansible-playbook by preparing a file that describes the target host as well as the time of ansible command.

$ Ansible-PlayBook Mysql.Yml I- hosts -k

Mysql package is installed on the target host using the yum module in this. I will specify the name of the group on the target host or host name of the target host near the top of the yaml file, the hosts. ansible is the user SSH login I specify the user name under which to.

{code}

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>