ANSIBLE CONFIGURATION INVENTOR .pdf
Original filename: ANSIBLE CONFIGURATION INVENTOR.pdf
This PDF 1.7 document has been generated by Microsoft® Word 2016, and has been sent on pdf-archive.com on 26/03/2018 at 18:51, from IP address 157.39.x.x.
The current document download page has been viewed 137 times.
File size: 234 KB (4 pages).
Privacy: public file
Download original PDF file
ANSIBLE CONFIGURATION INVENTORY
WHAT IS AN ANSIBLE INVENTORY?
The Ansible Inventory is a highly customizable component of Ansible. It is a configured location
where you can place credentials of the remote hosts, such as IP Address and Username. With
Ansible, you can effortlessly classify or group nodes depending on the type of application being
used. Ansible Inventory is highly customizable, and can efficiently work with dynamic sources
such as the cloud.
Ansible allows you to work with multiple inventory files at the same time. This way, you can
accomplish a number of tasks in a limited project timeline.
HOW TO CREATE AN ANSIBLE INVENTORY?
Creating an Ansible inventory is easy. It is just a plain text file written in YAML format.
Optionally, you can also write them in JSON format. Any text editor or IDE can be used to write
these files. Here we are using Microsoft Visual Studio Code.
You can execute node classification based on Operating System type, to find out the operating
systems of the two remote hosts.
Let’s create a new inventory file here. On the left-hand side pane, at the top, click the New
File icon next to WORKSPACE. Let’s name this file as inventory. The moment you start
typing on this page, it shows inventory as an open editor on the left-hand pane. This makes it
easy to keep track of the editors that are in progress.
In the inventory file, input the IP addresses and usernames for the target remote servers you
intend to configure using Ansible. This way, it informs Ansible that these are the servers to be
Let’s say you have two servers to manage – one is an Ubuntu machine, and another one is a
Fedora machine. On the first line, you can enter the IP address of the Ubuntu VM, followed by
192.168.180.131 ansible_ssh_user=tetra-noodle. On the second line, let’s enter the same
variable for the Fedora VM, that is IP address, followed by variable for username and then the
input value: 192.168.180.136 ansible_ssh_user=tetra-noodle. You can easily check for
reachability of the remote servers through the inventory file, by using the Ping Test.
Executing this test is as simple as running the command:
ansible all -m ping -i inventory
Here ansible is the main command. “all” stands for all target hosts.
Hyphen M stands for the name of the Ansible module being used – which in this case is ping.
Hyphen I stands for the inventory file.
This screenshot shows a successful ping test conducted via Ansible.
You can also classify the target nodes into groups of servers. To understand the concept of node
classification better, you can use a rule to classify the entries, say, using server type. For
instance, let’s say that you want to host a webserver on the Ubuntu VM, and a MySQL database
on the Fedora VM.
To start with, you need to configure the web server on the Ubuntu VM,
replace ubuntu with webserver in the square brackets. Let’s configure the database server on
the Fedora VM by replacing fedora with dbserver.
Now, you can run the ping test for the web server and database server. You can use the
integrated terminal in Visual Studio Code to run these commands.
The ping test commands you can use for the two servers are:
For the webserver
ansible webserver –m –i inventory
For the database server
ansible dbserver –m –i inventory
Using this feature of Ansible, you have the flexibility in specifying the nodes on which you want
to run the Ansible Playbooks.
You can efficiently run your IT configurations using the inventory file. You can use Ansible to
run multiple environments seamlessly. Ansible works smoothly with multiple cloud platforms
and data center infrastructures. This helps you achieve your business goals for IT innovation and
progress. Ansible’s deployment solutions are exactly what your IT automation processes need!
Source and Reference: http://tetranoodle.com/ansible-configuration-inventory-2/
For More Information:
Address: 469 E 58th Ave Vancouver BC Canada V5X 1W1
Contact No: 604.897.0195