This document explain how to install and configure vagrant to use Vmware Vcenter. Firstly we must install and configure our virtual environment. I have 2 ESXI servers worked with clustered storage from FC storage.

Before read this document you must install and configure your Fedora24 desktop with vagrant and ansible.

Install Vagrant Ansible and Virtualbox in Feora 24/25


Lets  start   the  article Vagrant  and Vsphere integration

The configuration of vCenter as following:

ESXI severs:
Vcenter server:

dev is the resource pool. The name Cluster will be used in our Vagrantfile. Right click on the Cluster(or Ctrl+O) and choose New Resource Pool. Select as default and write name is dev.

Right click on the dev resource pool and select New Virtual Machine (or Ctrl+N). Configure new virtual machine with you need and as operation system select CentOS7. Give name of virtual machine cos7box. Remove floppy device and select vlan for your network card in the DHCP subnet. Install your operation system as default with minimal installation. Set hostname cos7box and configure network card to start when system up. Disable IPv6. Set root password to vagrant.

After installation login to your Linux via ssh.

Update chache and packages:
[root@cos7box ~]# yum makecache fast
[root@cos7box ~]# yum update -y

Disable Selinux, firewalld and do reboot your template system:
[root@cos7box ~]# sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
[root@cos7box ~]# systemctl disable firewalld
[root@cos7box ~]# reboot

Install perl and needed packages because vmware-tools will be require:
[root@cos7box ~]# yum -y install perl net-tools bind-utils

Install vmware-tools. In the console of virtual machine select VM -> Guest -> Install/Upgrade Vmware Tools

In the Linux console mount cdrom and install vmware-tools:
[root@cos7box ~]# mount /dev/cdrom /media/
mount: /dev/sr0 is write-protected, mounting read-only
[root@cos7box ~]# cp /media/VMwareTools-10.0.0-3000743.tar.gz /root/
[root@cos7box ~]# cd /root/; tar zxf VMwareTools-10.0.0-3000743.tar.gz ; cd vmware-tools-distrib/

Answer the first question yes and select default to others(just press Enter button)
[root@cos7box vmware-tools-distrib]# ./
[root@cos7box vmware-tools-distrib]# ./
open-vm-tools are available from the OS vendor and VMware recommends using
open-vm-tools. See for more information.
Do you still want to proceed with this legacy installer? [no] yes
–the VMware team

Select VM -> Edit Settings and change cdrom to Host Device:

Add new user vagrant and give password vagrant:
[root@cos7box ~]# useradd -m vagrant
[root@cos7box ~]# passwd vagrant
Changing password for user vagrant.
New password: vagrant
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: vagrant
passwd: all authentication tokens updated successfully.

Give full access to vagrant user to use sudo:
[root@cos7box ~]# visudo
## Allows members of the users group to shutdown this system
# %users localhost=/sbin/shutdown -h now
Defaults:vagrant !requiretty

Gerate SSH folder to this user and download vagrant public key to this folder:

Set SSH permissions to work without warnings:

Shutdown the virtual machine and create template in the vcenter console of this machine:
[root@cos7box ~]# poweroff

Right click on the virtual machine select Template and Convert to Template:

Fedora desktop and install and configure vagrant with ansible

Create folder for our Vagrantfile and go to this folder:

Create temps folder for file syncronization and tasks folder for ansible playbooks:

Create cos7-playbook.yml file with the following content (This file will include install_nginx.yml file from tasks folder to install/configure and start nginx):

Create tasks/install_nginx.yml file with the following content:
[jshahverdiev@cons2 vsphere]$ cat tasks/install_nginx.yml
– name: NGINX | Installing NGINX repo rpm

– name: NGINX | Installing NGINX
name: nginx
state: latest

– name: NGINX | Starting NGINX
name: nginx
state: started

Install needed plugins:


Create and add new box for vsphere:

Look at box files:

Create vagrantfile with the following contents:

Use the following command to start new virtual machine and install nginx to this virtual machine(If you want to debug use the vagrant up –debug command):

Try to login to the virtual machine:


Please enter your comment!
Please enter your name here