Skip to content

Commit

Permalink
Fix initiated VM cannot be successfully vagrant up again, although th…
Browse files Browse the repository at this point in the history
…ere's more time to wait for it on windows environment.
  • Loading branch information
windperson committed Mar 26, 2016
1 parent 0a3953d commit a20a4fd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.synced_folder '.', '/home/vagrant/sync', disabled: true
config.vm.synced_folder '.', '/vagrant', disabled: false
end
#config.ssh.insert_key = false
config.ssh.insert_key = false

config.vm.hostname = 'dockerhost'
config.vm.define "dockerhost"
Expand Down Expand Up @@ -95,6 +95,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.omnibus.chef_version = :latest

config.vm.provision "chef_solo" do |chef|

if config.vm.box.to_s == "centos/7"
chef.add_recipe "centos7nic-patch"
end

chef.add_recipe "firewall"
chef.add_recipe "htop"

Expand Down
3 changes: 3 additions & 0 deletions cookbooks/centos7nic-patch/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name 'centos7nic-patch'
description 'Fix CentOS 7 box cannot vagrant up after successfully created and halted on virtualbox'
license 'Apache v2.0'
5 changes: 5 additions & 0 deletions cookbooks/centos7nic-patch/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if %w{rhel}.include?(node['platform_family']) and 7 <= node['platform_version'].to_i
bash 'make-fake-nic-detect-rule' do
code "ln -s /dev/null /etc/udev/rules.d/70-persistent-net.rules"
end
end
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and 4 require vagrant plugins:

The successfully initiated VM store its docker installation folder /var/lib/docker in separated disk file **disk_data/docker_data.vdi** , so you can backup & restore current docker image, containers and volume data even if VM deleted then recreated.

It use [official CentOS 7 vagrant box](https://vagrantcloud.com/centos/boxes/7) to run, and host mapping inside VM of this Vagrant project folder is **/vagrant**, the same as default vagrant configuration.
It use [official CentOS 7 vagrant box](https://vagrantcloud.com/centos/boxes/7) to "*power on*", which is made from [those script](https://github.com/CentOS/sig-cloud-instance-build/tree/master/vagrant), and host mapping inside VM of this Vagrant project folder is **/vagrant**, the same as default vagrant configuration.

You can tweak:

Expand Down

0 comments on commit a20a4fd

Please sign in to comment.