Ansible

How to install Ansible on Linux for vSphere configuration

Recently I took over a task to evaluate few DevOps configuration, automation and orchestration tools to configure VMware vSphere. There are many tools available in the market for DevOps automation. Personally I like and already worked on PowerCLI DSC earlier and have great expertise. Still I preferred Ansible since I have expertise on the same tool since great community support. Plus my entire team was using Ansible for other product configuration management and they had good hands on experience. Ansible server is called controller. This software is only installed on Linux OS. No software for windows. Here I am using CentOS version 7 to install Ansible. Installation is very straight just going through below commands. First i will prepare OS and update all the packages on Linux by running.

sudo yum update -y

Note: My linux server – Ansible controller has direct access to internet and all the packages are getting installed from online CentOS repository.

I will be Installing Ansible using python PIP. Below command installs python-setuptools. Why I am using pip here when yum can do the same task? I want Ansible and all the required modules to be of same version to avoid any dependencies or conflict. Differences in Ansible and module version might cause issues. PIP will give uniformity.

sudo yum install python-setuptools -y

This command installs PIP. PIP is a package manager for Python packages, or modules if you like.

sudo easy_install pip

This will install actual Ansible controller software, alternative to pip command is sudo yum install ansible.

sudo pip install ansible 

This is last step and shows how to install Ansible module pyvmomi for vSphere. Same step you can use to install any other modules.

sudo pip install pyvmomi

Everything is installed correctly till now. Its time to test Ansible, which I will test using ping module against localhost. I am getting success message with all green color messages after execution and response to ping is pong. In next article I will use it to configure Esxi servers.

ansible localhost -m ping

Useful Article
Connect-VIServer Error: Invalid server certificate. Use Set-PowerCLIConfiguration

Leave a Reply

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