Windows user trouble with syntax

21 views
Skip to first unread message

nbmp...@gmail.com

unread,
Sep 19, 2017, 3:31:15 AM9/19/17
to Vagrant
Hi there,

I'm new to vagrant and have no experience with linux. Installed vagrant on windows 10 and successfully got a virtual windows 2012 server up and running on virtualbox. My vagrantfile looks like this:

#Vagrant 1.6+ natively supports Windows guests over WinRM.
Vagrant.require_version ">= 1.6"

Vagrant.configure("2") do |config|

config.vm.box = "testbox"

config.vm.communicator = "winrm"

    config.vm.provider :virtualbox do |v|
        v.name = "win2012_test"
        v.cpus = 2
        v.memory = 2048
    end

$install = <<SCRIPT
choco install chocolatey -y -f
choco install powershell -y -f
choco install tomcat -y -f
SCRIPT
config.vm.provision "shell", inline: $install

config.vm.provision "file", source: "template.war", destination: "C:\Program Files\Apache Software Foundation\tomcat\apache-tomcat-8.5.12\webapps\tmt.war"

end

The file is in my vagrant root folder. The script finishes after a while but no VM created. When I remove the last line the VM is created succesfully again.

The outcome of this project must be a VM with powershell 5 and apache tomcat installed. Then I need to copy several files, including a powershell script that needs to run on the vm.


Any help would be appreciated.

Alvaro Miranda Aguilera

unread,
Sep 19, 2017, 7:27:44 AM9/19/17
to vagra...@googlegroups.com
Hello

Did you check this part of the documentation?

The file uploads by the file provisioner are done as the SSH or PowerShell user. This is important since these users generally do not have elevated privileges on their own. If you want to upload files to locations that require elevated privileges, we recommend uploading them to temporary locations and then using the shell provisioner to move them into place.

Perhaps thats the problem?

Can you runt he vagrant up with debug mode?

vagrant destroy
vagrant up --debug

and share the verbose output in a gist ? (gist.github.com)

Thanks
alvaro


--
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 vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/060592f3-fb91-4558-9aa4-acd62d53b45f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

nbmp...@gmail.com

unread,
Sep 20, 2017, 1:45:47 AM9/20/17
to Vagrant
Hi Alvaro,

Thanks for replying. I figured out that the correct syntax is:

config.vm.provision "file", source: "/Files", destination: "/Automate"

Which copies all files from the folder Files in the same drive as the vagrantfile is located. Destination is c:\automate. It is not possible to define any specific drive or share. 

Also the mounted host share "vagrant" is not accessible on the vm. It's a WINRM limitation.

They need to do more windows support.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages