<< Introduction >> << Ansible Inventory >>
Install AnsibleAnsible to be installed only on the Control Nodes for which ansible codes will run. Other managed systems are agent less and no ansible packages to be installed on them.
The control nodes should be a Unix or Linux system. Though the Windows machines can be managed by Ansible, it is not supported as a control node. Ansible needs Python with version 2.6 or later (Python 2) in the control node to install ansible as a pre-requisite. Note: - Python 3 is still in technology validation and that should not be used for ansible in production environment.
Below the specification of the system used in this tutorial:
OS – CentOS 7
Python – Version 2.7.5
Ansible can be installed in the control node (CentOS 7) using yum command. Check if the python has already been installed in the system by below command. If not yet installed, still the ansible installation will take python as well as dependency package while installing it.
[root@anslabsrv1 ~]# yum list installed python
python.x86_64 2.7.5-86.el7 @anaconda
This shows that the python packages are already installed in the system. Let’s install ansible in the system now.
[root@anslabsrv1 ~]# yum install ansible -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
--> Running transaction check
---> Package ansible.noarch 0:126.96.36.199-2.el7 will be installed
--> Finished Dependency Resolution
Package Arch Version Repository Size
Ansible noarch 188.8.131.52-2.el7 extras 7.6 M
Install 1 Package
Total download size: 7.6 M
Installed size: 38 M
ansible-184.108.40.206-2.el7.noarch.rpm | 7.6 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Installing : ansible-220.127.116.11-2.el7.noarch 1/1
Verifying : ansible-18.104.22.168-2.el7.noarch 1/1
Now we have installed ansible binaries in our control system. You may refer the ansible website https://www.ansible.com/resources/get-started to obtain more details on installation and update of ansible.
Communication with Managed systems:
Ansible control node has to communicate with managed systems over the network. By default, ansible uses “ssh” as the protocol but for other devices like Windows systems and network devices, it might use other protocols as well. In addition to this python2-winrm RPM package with version 0.2.2 or later to be installed in the control node, if we need to manage any Windows based systems.
In the same time, manages hosts do not require ansible installed in it. But they also should have python 2 (2.4 or later) to be installed for most of the ansible modules to work. The package libselinux-python to be installed in the managed systems, if they are running with SELinux enabled. Keep in mind that python is not required in the managed systems to run some of the modules of ansible. Refer Ansible documentation for Installation, Ansible for networking and Ansible for Windows to get more details on the installation of control nodes and managed systems.