Home » OpenESB » Ansible – Configuration and Management Tool

Ansible – Configuration and Management Tool

Ansible is a configuration management open source software. It can use to setup client/remote system,
or in other words install your require packages to client/remote system. Ansible usage of SSH for transport. Ansible script is written into YML(yet another markup language).

How does ansible works?
Ansible sends its commands one by one to remote machine in each separate SSH connection. Ansible never install any agent to remote machine, that’s what make ansible a powerful configuration and management tool.

How does ansible works in background?

you describes your commands in YML file.
whenever you run its converted into relative shell script command.
it copies each command to target node via ssh
runs each command
collects the outputs and returns it.

How to install ansible on your linux system?
So the machine you are using to run ansible yml script that should have ansible runner to run it. ansbile never get installed on remote machine, but it must be present on the machine that which is used to run ansible script.
how to install ansible in ubuntu linux system ?

sudo apt-get update
sudo apt-get install -y git
sudo apt-get install software-properties-common
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update -y
sudo apt-get install -y ansible

how to install ansible on CentOS, RHEL, or Scientific Linux ?

sudo yum update -y
sudo yum install -y ansible

What is “hosts” file(inventory file) in ansible?
In Simple language here you enter the addresses of remote machine. So the whenever you run ansible script, ansbile-runner will look into hosts file and get the remote address.
what more you can do with host file is, you can define multiple remote machine addresses, group them, and one host can have multiple groups.
Here is one simple example of host file:

[remotemachine]
xx.xx.xx.xx

Here is one complex example of “hosts” file

[south_east_aisa]
xx.xx.xx.x1
xx.xx.xx.x2

[south_aisa]
xx.xx.xx.x1
xx.xx.xx.x2
xx.xx.xx.x3

[asia:children]
south_asia
south_east_asia

[aisa:vars]
foo_var=hello asia

[world:children]
asia
africa
america

Note: you can hosts file detail into file into “/etc/ansible/hosts” OR define anywhere and use command “-i path/to/your/hosts” while running ansible script.

How to run ansible script?
in simple way ansbile can be run by using command:

ansible-playbook playbook.yml

if you want to define host file location then use this

ansible-playbook playbook.yml -i path/to/hosts

if you want to run some of your command using super user

ansible-playbook playbook.yml -s

if you want to run ansible command with login as some_user to remote machine

ansible-playbook playbook.yml -u user_name

if you wants to run ansible command and provide private-key to access remote machine then

ansible-playbook playbook.yml –private-key=yourkey.pem

to check ansible script before run

ansible-playbook playbook.yml –check

to run ansible script on your local system for testing

ansible-playbook playbook.yml -c local

please send us an email for any query? Or post your comment below.

Comments

  1. Sanjay says:

    This is what i was looking for. Superb!!

  2. tekslate says:

    Nice Article. Thanks for the information. We also provide Ansible online training.
    check this site Tekslate for indepth Ansible training.

  3. vignes says:

    Grateful article.In this opportunity i want give that my point of view grace post I would be looking forwards to my friend.I’ll check that your sites is very good post.

  4. gracylayla says:

    Thank you for providing the best information on Ansible – Configuration and Management Tool.

  5. This tutorial helps me to configure Ansible tool.

  6. The Post seems to be good I really gather a lot of information from the post thanks for sharing this awesome post.

  7. Navin L says:

    Thanks for great article!!

  8. Nancy says:

    Your blog is very useful for me, Thanks for your sharing.


    MSBI Training in Hyderabad

  9. Mike says:

    Superb info, well explained

  10. Himagirish says:

    Nice Article on ansible configuration provides very useful information to ansible aspirants.Thank you for sharing

  11. aveesha says:

    This post is really helpful and you always provide the best information. Thanks for sharing with us…
    The best online training in Mindmajix:
    oracle demantra online training

  12. sithara says:

    Really impressive information in regards to Android and I am going to improve my skills for sure. Thanks for the valuable information. Api Testing

  13. Leo says:

    Articles gives fair info to beginners, thanks for sharing.

  14. vijaya says:

    Ansible is the most useful tool for DevOps work.
    LandMark Hospitals

  15. Your content is very impressive and thanks for sharing this article. its very useful.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*