How to Install and Configure ‘Ansible’ Automation Tool for IT Management – Part 1

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Babin Lonston

I'm Working as a System Administrator for last 10 year's with 4 years experience with Linux Distributions, fall in love with text based operating systems.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

49 Responses

  1. sumit kumar chaurasia says:

    Hi ,

    I am trying to create /etc/ansible/hosts file but it is not allowing me to either touch this file or save this file

    [[email protected] ~]# ansible –version
    config file =
    configured module search path = Default w/o overrides
    [[email protected] ~]# touch /etc/ansible/hosts
    touch: cannot touch ‘/etc/ansible/hosts’: No such file or directory

    when i am doing vim /etc/ansible/hosts it is giving below error whien i am trying to save
    “/etc/ansible/hosts” E212: Can’t open file for writing

    Is this file created by default or we need to create manually

  2. MD says:

    Thanks for this post., I am looking for installation of ansible from the servers which is not exposed to internet. I downloaded the ansible tar.gz from git hub and ran make command but getting error as below
    ansible –version
    Traceback (most recent call last):
    File “/home/jboss/Ansible/ansible-”, line 44, in
    import ansible.constants as C

    I tried adding the env variables like below but again seeing exception
    export PATH=$PATH:$ANSIBLE/bin
    export PYTHONPATH=$ANSIBLE/lib
    export ANSIBLE_LIBRARY=$ANSIBLE/library

    ansible:85: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
    if e.message.endswith(‘ %s’ % sub):
    ERROR! Unexpected Exception: No module named yaml
    the full traceback was:

    Traceback (most recent call last):
    File “/home/jboss/Ansible/ansible-”, line 81, in
    from ansible.cli.adhoc import AdHocCLI as mycli
    File “/home/jboss/Ansible/ansible-”, line 27, in
    import yaml
    ImportError: No module named yaml

    Kindly suggest to prepare install the prerequisites and ansible in my situation

  3. drmarconi says:

    Noticed a possible typo – shouldn’t the prerequisite “parmiko” be “paramiko”? As in python-paramiko package (or pip install paramiko)?

  4. Nakul says:

    When i tried to copy remote server to ssh, then i got below error.

    ]$ ssh-copy-id
    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
    /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed — if you are prompted now it is to install the new keys
    [email protected]‘s password:

    Could not chdir to home directory /export/home/akumar3: No such file or directory

    Please suggest.

  5. Erick Bazan says:

    hi, excellent post, just having a doubt here, I’m getting the same error sampada does, I already tried with the user the ssh keys generated, any idea what might be happening? thanks

  6. Sampada Jain says:

    Hi I am trying to set up a ansible lab on azure cloud and trying to get hand on to replace puppet actually.
    But when I m trying to run : [ ansible -m ping web-servers ]
    I am getting a error as : as mentioned below in-between [ ]

    [ | UNREACHABLE! => {
    “changed”: false,
    “msg”: “Failed to connect to the host via ssh.”,
    “unreachable”: true


    So I tried command : [ ansible -m ping web-servers:2222 ]
    But i am still getting the error as : [ [WARNING]: provided hosts list is empty, only localhost is available ]

    Can somebody help me please

    Thank you

  7. Prince Chaudhary says:

    it was really interesting…

  8. David leatherman says:

    Thanks, very useful for a new user of ansible….

  9. Daniel says:

    Hello. I am trying to setup ansible on my home network for testing and mabey replace puttet if i like anisble.
    BUT! I have copied the key from my anisble host to my test vm, added the ip for my test vm in sudo vim /etc/ansible/hosts under [web-servers]
    but when i am trying to ping the test vm from anisble then i get this message ?

    # ansible -m ping web-servers
    # No hosts matched

  10. kranzella says:

    Excellent, nice job! :)

Leave a Reply to sumit kumar chaurasia Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.