I'm glad they worked for you! It took me a few iterations to sort out the
right syntax. Sometimes you need to carefully check the dates and versions
of the examples you are looking at as it is easy to start down a path with
outdated information or incomplete examples (Ansible suffers from this as
well). Sally's comment about Vagrant not removing drives is a good
example.  That was true of older Vagrant/Vbox combinations but if you use
the right Ruby syntax Vagrant will correctly clean up after itself after a
"vagrant destroy". My examples consistently work correctly - unless
interrupted mid-flight - then some manual cleanup might be necessary.

Regards,



On Tue, Oct 15, 2019 at 1:55 PM Brian Carpenter <
[email protected]> wrote:

> Thanks for the examples Karl,
>
> I have changed my Vagrantfile to the following:
> cat Vagrantfile && vagrant destroy -f &&echo "files before up"&& ls -a1
> &&vagrant up; echo "files after up"; ls -a1
> # -*- mode: ruby -*-
> # vi: set ft=ruby :
>
> Vagrant.configure("2") do |config|
>   config.vm.box = "centos/7"
>     config.vm.provider "virtualbox" do |vb|
> vb.customize ['storagectl', :id, '--name',  'SATA Controller', '--add',
> 'sata',  '--controller', 'IntelAhci', '--portcount', 8]
>
> (1..5).each do |hd|
>   unless File.exist?("./disk#{hd}.vdi")
>     vb.customize ['createhd', '--filename', "./disk#{hd}.vdi", '--size',
> 1024]
>   end
>           vb.customize ['storageattach', :id,  '--storagectl', 'SATA
> Controller', '--port', "#{hd}" ,'--device', 0, '--type', 'hdd', '--medium',
> "./disk#{hd}.vdi"]
>   end
>   end
> end
> ==> default: Forcing shutdown of VM...
> ==> default: Destroying VM and associated drives...
> files before up
> .
> ..
> .vagrant
> Vagrantfile
> Bringing machine 'default' up with 'virtualbox' provider...
> ==> default: Importing base box 'centos/7'...
> ==> default: Matching MAC address for NAT networking...
> ==> default: Checking if box 'centos/7' version '1905.1' is up to date...
> ==> default: Setting the name of the VM: centos_default_1571172546672_17886
> ==> default: Fixed port collision for 22 => 2222. Now on port 2200.
> ==> default: Clearing any previously set network interfaces...
> ==> default: Preparing network interfaces based on configuration...
>     default: Adapter 1: nat
> ==> default: Forwarding ports...
>     default: 22 (guest) => 2200 (host) (adapter 1)
> ==> default: Running 'pre-boot' VM customizations...
> ==> default: Booting VM...
> ==> default: Waiting for machine to boot. This may take a few minutes...
>     default: SSH address: 127.0.0.1:2200
>     default: SSH username: vagrant
>     default: SSH auth method: private key
>     default:
>     default: Vagrant insecure key detected. Vagrant will automatically
> replace
>     default: this with a newly generated keypair for better security.
>     default:
>     default: Inserting generated public key within guest...
>     default: Removing insecure key from the guest if it's present...
>     default: Key inserted! Disconnecting and reconnecting using new SSH
> key...
> ==> default: Machine booted and ready!
> ==> default: Checking for guest additions in VM...
>     default: No guest additions were detected on the base box for this VM!
> Guest
>     default: additions are required for forwarded ports, shared folders,
> host only
>     default: networking, and more. If SSH fails on this machine, please
> install
>     default: the guest additions and repackage the box to continue.
>     default:
>     default: This is not an error message; everything may continue to work
> properly,
>     default: in which case you may ignore this message.
> ==> default: Rsyncing folder: /home/brian/projects/centos/ => /vagrant
> files after up
> .
> ..
> disk1.vdi
> disk2.vdi
> disk3.vdi
> disk4.vdi
> disk5.vdi
> .vagrant
> Vagrantfile
>
>
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/794e8dde-f244-4676-8aa6-412974405967%40googlegroups.com
> <https://groups.google.com/d/msgid/vagrant-up/794e8dde-f244-4676-8aa6-412974405967%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
---------------------------------------------------------------
Karl Vietmeier, Cloud Solutions Architect
949-300-7123

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/CAC3PyV%3D57mMLDpsFu0w1tmYH2J9Vn7WFFC-AvFp_Jd32jqpamg%40mail.gmail.com.

Reply via email to