HomeAutomation Tools

Ansible Installation and Configuration on Redhat/CentOS 7

Ansible Installation and Configuration on Redhat/CentOS 7
Like Tweet Pin it Share Share Email

Step 3: INVENTORY
Use the default one /etc/ansible/hosts or create a custom host file. This is an inventory file where you have to maintain your remote host’s list. I will discuss more Ansible inventory in the next article.

The things in brackets are group names, which are used in classifying systems and deciding what systems you are controlling at what times and for what purpose.

Suggested Read: Quick Introduction to Static and Dynamic Inventories

My Inventory file (Static). The format for /etc/ansible/hosts is an INI format and looks like this:

Ansible

 

Step 4: Ansible Ad-Hoc COMMANDS:
Introduction To Ad-Hoc Commands Examples of basic commands. An ad-hoc command is something that you might type in to do something really quick, but don’t want to save for later.
This is a good place to start to understand the basics of what Ansible can do prior to learning the playbooks language
– ad-hoc commands can also be used to do quick things that you might not necessarily want to write a full playbook for. Basically, the true power of Ansible is playing with playbooks. I will discuss playbook in the coming articles.

Run your first Ansible Ad-Hoc command to check ping response from remote hosts. The following examples show how to use /usr/bin/ansible for running ad hoc tasks

Ansible

An Another command to know uptime for your all remote hosts from the Ansible inventory.

 

Ansible

Step 5: Ansible MODULES
Ansible provides no. of modules that can be executed directly on remote hosts or through playbooks. Modules (also referred to as “task plugins” or “library plugins”) are the ones that do the actual work in ansible, they are what gets executed in each playbook task.
Confused ??? Let’s check all available modules on the Ansible server. You can get your Modules list and the module Documentation by running the below commands. List all modules available with that particular Ansible version
# ansible-doc -l
Check information of particular module
# ansible-doc <module>

LIST ALL MODULES

 

Ansible

VIEW MODULE DOCUMENTATION
Syntax : ansible-doc <module_name>

The below command will show you the document about “shell module”. press “q” for quit from document page.

 

Ansible

Also, check out the below video for More details:Ansible

Conclusion: This is all about Ansible basics. if you’re cleared about the basics, then you are ready to move the next level to play with some basic Ad-Hoc commands on the remote host. I will share more information about Ad-Hoc commands in the next articles. I hope this guide will help you to start your journey towards Automation with Ansible.

 

Comments (18)

  • Very Good article

    Reply
  • Hey! Someone in my Myspace group shared this site with us so I came to take a look.

    I’m definitely enjoying the information. I’m book-marking and will be
    tweeting this to my followers! Wonderful blog and fantastic design.

    Reply
  • We are a bunch of volunteers and opening a brand new scheme in our community. Your web site provided us with useful information to work on. You have performed a formidable activity and our entire group will likely be thankful to you.

    Reply
  • Howdy! This post couldn’t be written any better!
    Reading this post reminds me of my previous
    room mate! He always kept talking about this. I will forward this page to him.
    Fairly certain he will have a good read. Thanks for sharing!

    Reply
  • I know this website offers quality dependent articles and additional stuff, is
    there any other website which provides these stuff in quality?

    Reply
  • Utterly composed subject material, appreciate it for entropy.

    Reply
  • Hi, I do believe this is an excellent website. I stumbledupon it 😉 I may return yet again since i have saved as a favorite it. Money and freedom is the best way to change, may you be rich and continue to guide others.

    Reply
  • Way cool! Some very valid points! I appreciate you penning this post plus the rest of the website is extremely good.

    Reply
  • I’m not sure where you are getting your information, however great topic. I must spend a while studying more or working out more. Thank you for fantastic information I used to be looking for this information for my mission.

    Reply
  • After looking over a few of the blog posts on your blog, I honestly like your way of writing a blog. I book-marked it to my bookmark website list and will be checking back soon. Take a look at my web site as well and let me know what you think.

    Reply
  • Hi Mate,

    Could you please reproduce same thing with Ansible tower and write some article like this

    Reply
  • Awesome document. Please keep share the knowledge

    Reply
  • I simply want to say I’m beginner to weblog and absolutely loved your blog. Almost certainly I’m likely to bookmark your website . You definitely come with superb posts. Regards for sharing with us your web-site.

    Reply
  • Hello there, just became aware of your blog through Google, and found
    that it is really informative. I am gonna watch out for
    brussels. I will be grateful if you continue this in future.

    Numerous people will be benefited from your writing.
    Cheers!

    Reply
  • Wonderful post however I was wondering if you could write a litte more on this topic?
    I’d be very grateful if you could elaborate a little bit further.
    Thank you!

    Reply
  • Do you mind if I quote a few of your posts
    as long as I provide credit and sources back to your site?
    My blog is in the very same area of interest as yours and
    my visitors would genuinely benefit from a lot of the information you present
    here. Please let me know if this ok with you. Appreciate it!

    Reply

Leave a 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.