Custom Search
Showing posts with label Vagrant. Show all posts
Showing posts with label Vagrant. Show all posts

Friday, April 1, 2016

How to Vagrant Virtualbox restart a Virtual Machine

How to Vagrant Virtualbox restart a VM

$VBoxManage list vms

$VBoxManage controlvm reset





Saturday, January 9, 2016

How to Install vagrant-scp plugin and copy file from Vagrant VM to Host Machine

1)
Install vagrant-scp plugin
a)
$vagrant plugin install vagrant-scp

b)
$vagrant scp [local_path] [vm_name]:[remote_path]
$vagrant scp [vm_name]:[remote_path] [local_path]

OR

2)
a)
How to copy file from Host Machine to Vagrant VM
$scp -i /root/puppet-vpc/.vagrant/machines/vpc-ctrl1/virtualbox/private_key -P 2201 myfile.txt vagrant@127.0.0.1:~

b)
How to copy file from Vagrant VM to Host Machine

$scp -i /root/puppet-vpc/.vagrant/machines/vpc-ctrl1/virtualbox/private_key -P 2201 vagrant@127.0.0.1:~/myfile.txt .

Monday, November 30, 2015

vagrant virtualbox VM creation command VBoxManage

You can see this command if you run "ps -aux | grep VBoxManage" just after "vagrant up".

$/usr/lib/virtualbox/VBoxManage import /root/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64/20151117.0.0/virtualbox/box.ovf --vsys 0 --vmname ubuntu-cloudimg-trusty-vagrant-amd64_1448828432010_1244 --vsys 0 --unit 6 --disk /root/VirtualBox VMs/ubuntu-cloudimg-trusty-vagrant-amd64_1448828432010_1244/box-disk1.vmdk

Friday, November 27, 2015

vagrant multinode setup

1)
Ubuntu 14.04.3 LTS
#sudo -i

2)
#export no_proxy='127.0.0.1,169.254.169.254,localhost'
#export http_proxy='http://100.140.192.30:10000/'
#export https_proxy='http://100.140.192.30:10000/'


3)
#apt-get update

4)
a)

#echo "deb http://download.virtualbox.org/virtualbox/debian trusty contrib" | sudo tee -a /etc/apt/sources.list

b)
#cat /etc/apt/sources.list | grep virtualbox
deb http://download.virtualbox.org/virtualbox/debian trusty contrib


5)
#apt-get update
GPG error: http://download.virtualbox.org trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54422A4B98AB5139

6)
#apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 54422A4B98AB5139

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.yjM7CTppoR --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 54422A4B98AB5139
gpg: requesting key 98AB5139 from hkp server keyserver.ubuntu.com
gpg: key 98AB5139: public key "Oracle Corporation (VirtualBox archive signing key) " imported
gpg: Total number processed: 1
gpg:               imported: 1

7)
#apt-get update

8)
#apt-get install linux-headers-3.13.0-63-generic

9)
#apt-get install virtualbox-5.0

10)
Install vagrant
#wget --no-check-certificate https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb
#dpkg -i vagrant_1.7.4_x86_64.deb


11)
Install librarian-puppet
#apt-get install ruby
#gem install librarian-puppet-simple --no-ri --no-rdoc


12)
#apt-get install git
#git clone https://github.com/sajuptpm/puppet-mycloud


13)
#cd puppet-mycloud

14)
Install all puppet-mycloud dependencies from file "$pwd/Puppetfile" to "$pwd/modules"
#export pwd=`pwd`
#export git_protocol=https
#librarian-puppet install --puppetfile=$pwd/Puppetfile  --path=$pwd/modules


15)
Initialize Vagrant setup
#./vagrant_parallel_provision.sh initialize

* This command will provision a dhcp server and a separate vboxnet adapter.
* This command will provision "httpproxy1" server, that contains dhcp and proxy server.
* Before running the next command , ensure puppet has completed the provision of httpproxy server.

16)
Fix for Connection timeout:

httpproxy1: SSH address: 127.0.0.1:2222
httpproxy1: SSH username: vagrant
httpproxy1: SSH auth method: private key
httpproxy1: Warning: Connection timeout. Retrying...
httpproxy1: Warning: Connection timeout. Retrying...

* Check "/etc/resolv.conf" for correct "nameserver" entry.

17)
#bash vagrant_parallel_provision.sh up >> vagrant.log 2>&1 &

* The above commands , creates a new token for consul.The token and the "vboxnet" for your cluster can be found in the "vagrant_keys".

18)
In order to recreate the  vagrant environment:
#bash vagrant_parallel_provision.sh reset >> vagrant.log 2>&1 &
This will reprovision the entire setup in a new network and a new consul token.    

19)
In order to reprovision the environment by making changes in puppet-mycloud code;
#bash vagrant_parallel_provision.sh provision >> vagrant.log 2>&1 &

20)
In order to destroy the entire system
#bash vagrant_parallel_provision.sh destroy>> vagrant.log 2>&1 &

21)
In order to destroy and bring up a single server in the cluster
#vagrant destroy gcp1
#source vangrant_keys
#vagrant up gcp1


22)
In order to get the status of vagrant servers:
#vagrant status

23)
In order to login to a specific server:
#vagrant ssh gcp1

24)
In order to cleanup the environment:
#bash vagrant_parallel_provision.sh cleanup