Windows user trouble with syntax

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows user trouble with syntax

nbmprivat
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.

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Windows user trouble with syntax

Alvaro Miranda Aguilera
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


On Tue, Sep 19, 2017 at 9:31 AM, <[hidden email]> wrote:
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.

--
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 [hidden email].
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0exckkGfbhohD%2BYb_O%3DzWfOpz9U9f8bUgqfbVb6ZiQYW6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Windows user trouble with syntax

nbmprivat
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.

Den tirsdag den 19. september 2017 kl. 13.27.44 UTC+2 skrev Alvaro Miranda Aguilera:
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 <a href="https://www.vagrantup.com/docs/provisioning/shell.html" style="color:rgb(21,99,255);font-family:&quot;Open Sans&quot;,sans-serif;font-size:15px" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fprovisioning%2Fshell.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE5Sz_XDx3nvZc80g0RZ5bOr6jr6g&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fprovisioning%2Fshell.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE5Sz_XDx3nvZc80g0RZ5bOr6jr6g&#39;;return true;">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 ? (<a href="http://gist.github.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgist.github.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGRWsXDI8gmejU5HXZxw_mFAigdzQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgist.github.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGRWsXDI8gmejU5HXZxw_mFAigdzQ&#39;;return true;">gist.github.com)

Thanks
alvaro


On Tue, Sep 19, 2017 at 9:31 AM, <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="WFnrd-B2BAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">nbmp...@...> wrote:
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|
        <a href="http://v.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fv.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEHaIhv1TfOwNl5ySsvgF-Akko5KQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fv.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEHaIhv1TfOwNl5ySsvgF-Akko5KQ&#39;;return true;">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.

--
This mailing list is governed under the HashiCorp Community Guidelines - <a href="https://www.hashicorp.com/community-guidelines.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.hashicorp.com%2Fcommunity-guidelines.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHa_CaKfZaJiwbkUndUQbVGlQCDw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.hashicorp.com%2Fcommunity-guidelines.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHa_CaKfZaJiwbkUndUQbVGlQCDw&#39;;return true;">https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: <a href="https://github.com/mitchellh/vagrant/issues" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fissues\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxcA5DuHlQlPInMi_k1Pz4pMNqNw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fissues\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxcA5DuHlQlPInMi_k1Pz4pMNqNw&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="WFnrd-B2BAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vagrant-up+...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/vagrant-up/060592f3-fb91-4558-9aa4-acd62d53b45f%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/060592f3-fb91-4558-9aa4-acd62d53b45f%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/060592f3-fb91-4558-9aa4-acd62d53b45f%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/vagrant-up/060592f3-fb91-4558-9aa4-acd62d53b45f%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c573f85b-07a1-4d6b-9f19-b78f830d1eb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.