Ansible is simple IT Automation Tool


Ansible is powerful tool for automate application and IT Non IT infrastructure. Continuous Development, Integration and Deployment and Configuration Management. Work on agent less with SSH configuration or zero downtime rolling updates. It's open source tool. For more details Click Me

Ansible, yml, playbooks flow















Installation details Click Me
Note: Install Python 2.7.x and Install Ansible

Installation verification:
Logging into server, change the dir to /opt/ansible
[ansible@tutorialbyexample ansible]$ ansible --version
ansible 1.7

Default installation directory /opt/ansible





Creating a basic inventory file
Inventory file in Ansible have list of servers to communicate with. Inventory file known as hosts file located under /etc/ansible/hosts content name of group and IP's.

$ sudo mkdir /etc/ansible
$ sudo touch /etc/ansible/hosts

Edit this hosts file with any editor whatever you like e.g: nano, vim. Note you’ll need to edit it with
sudo/as root. As all data or host are accessible by root/or equivalent user only.

hosts:

 [local]
 127.0.0.1

Save & quit it.

Where as [local] is name of group going to identified by list of IP's. We can add multiple group and respective IP's' E.g:
hosts:

[db]
127.0.0.10
127.0.0.11
127.0.0.12

[app]
127.0.0.20
127.0.0.21
127.0.0.22

[web]
127.0.0.30
127.0.0.31
127.0.0.32

All IP's are example only.

How to execute the simple free -m command in Ansible:

[ansible@tutorialbyexample ansible]$ ansible local -a "free -m" -u ansible -k
SSH password:
127.0.0.1 | success | rc=0 >>
             total       used       free     shared    buffers     cached
Mem:  15951    15742      208          0       1725      11903
-/+ buffers/cache:       2113      13837
Swap:         1023          4       1019

[ansible@tutorialbyexample ansible]$ ansible local -a "df -h" -u ansible -k
SSH password:
127.0.0.1 | success | rc=0 >>
Filesystem                  Size  Used Avail Use% Mounted on
/dev/tutorialbyexample1     29G   26G  1.9G  94% /tutorialbyexample1
/dev/tutorialbyexample2     29G   15G   13G  54% /tutorialbyexample2

In next tutorial we'll see how ansible playbook.yml work.

Please provide your input if any. Have good day ahead!!!

References

http://www.ansible.com/

6 comments:

  1. Good for startup about ansible...

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
    Replies
    1. Good to see your comments about my post, but you are also doing promotion of your course! I will suggest go through the below link and you will get more details about it.

      http://www.tutorialbyexample.com/

      http://www.tutorialbyexample.com/search/label/Testing

      http://www.tutorialbyexample.com/2015/02/oracle-database-testing-jmeter-tutorials.html

      http://www.tutorialbyexample.com/2015/09/loadperformanceapachejmetertesting.html

      http://www.tutorialbyexample.com/2015/02/oracle-database-testing-jmeter-tutorials.html

      Delete
  3. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking. montaggio cancello automatico

    ReplyDelete