Book Image

Learning Ansible 2 - Second Edition

Book Image

Learning Ansible 2 - Second Edition

Overview of this book

Ansible is an open source automation platform that assists organizations with tasks such as configuration management, application deployment, orchestration, and task automation. With Ansible, even complex tasks can be handled easier than before. In this book, you will learn about the fundamentals and practical aspects of Ansible 2 by diving deeply into topics such as installation (Linux, BSD, and Windows Support), playbooks, modules, various testing strategies, provisioning, deployment, and orchestration. In this book, you will get accustomed with the new features of Ansible 2 such as cleaner architecture, task blocks, playbook parsing, new execution strategy plugins, and modules. You will also learn how to integrate Ansible with cloud platforms such as AWS. The book ends with the enterprise versions of Ansible, Ansible Tower and Ansible Galaxy, where you will learn to interact Ansible with different OSes to speed up your work to previously unseen levels By the end of the book, you’ll able to leverage the Ansible parameters to create expeditious tasks for your organization by implementing the Ansible 2 techniques and paradigms.
Table of Contents (16 chapters)
Learning Ansible 2 Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Hello Ansible


As we have seen in the previous chapter, it is possible to use Ansible to automate simple tasks that you probably already perform daily.

Let's start by checking if a remote machine is reachable; in other words, let's start by pinging a machine. The simplest way to do this, is to run the following:

$ ansible all -i HOST, -m ping

Here, HOST is an IP address, the Fully Qualified Domain Name (FQDN), or an alias of a machine where you have SSH access (you can use a Kernel-based Virtual Machine (KVM), as we have seen in the previous chapter).

Tip

After the "HOST," the comma is mandatory, because otherwise it would not be seen as a list, but as a string.

In this case, we have performed it against a virtual machine on our system:

$ ansible all -i test01.fale.io, -m ping

You should receive something like this as a result:

test01.fale.io | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Now, let's see what we did and why. Let's start from the Ansible help. To query it, we can...