hello

for the shell part is how you are running the scripts.

packer will copy the file and run it

but you have this:

    {
      "type": "shell",
      "script": "scripts/vm_deploy.sh",
      "execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }}
sudo -E -S sh '{{ .Path }}'"
    },


so it will do sh <file>


i will say make the user to be able to sudo without password


and use a more simple scripts line, like


    {
      "type": "shell",
      "script": "scripts/vm_deploy.sh"
    },


vm_deploy.sh


#!/usr/bin/env bash

echo "hello from the VM!!!"

id

sudo id


Alvaro.



On Thu, Oct 13, 2016 at 8:06 PM, Nick S <nsti...@boundlessgeo.com> wrote:

> Couple updates...
>
> 1) Removing the 3 ssh parameters seemed to fix the issue. They were:
>
>       "ssh_disable_agent": true,
>       "ssh_host": "localhost",
>       "ssh_port": "2022",
>
> 2) The shell script section cannot execute scripts in bash, despite the
> #!/bin/bash header. I've implemented a work-around to make this
> shell-friendly.
> 3) The VirtualBox job exports as an ovf, I need this to be a single file
> ova export. Will open separate ticket.
>
> Thanks for the assist!
>
>
> On Tuesday, October 11, 2016 at 6:54:25 AM UTC-4, Alvaro Miranda Aguilera
> wrote:
>>
>> Hello
>>
>> You are giving fixed ports in the template:
>>
>>       "ssh_host": "localhost",
>>       "ssh_port": "2022",
>>
>> That is not needed.
>>
>> That is usually used when packer won't find the ports, but in Virtualbox
>> and VMWare packer does it for you.
>>
>> ie. have a look at this template:
>> https://github.com/cbednarski/packer-ubuntu/blob/master/1404
>> -dev.json#L56-L97
>>
>> Packer will scan the IP from Vbox/vmware for dhcp and forward a port to
>> the VM on port 22
>> then use that port automatically
>>
>> Alvaro
>>
>> On Tue, Oct 11, 2016 at 2:04 AM, Nick S <nst...@boundlessgeo.com> wrote:
>>
>>> I'm trying to create a VirtualBox OVA off a Ubuntu Trusty ISO. I've ran
>>> through debug mode and I'm presently set up to run with the GUI enabled, at
>>> which point, and I see an issue with the mechanism around finding SSH
>>> available. Since this is VirtualBox running NAT, I've set up port
>>> forwarding and configured the SSH agent in the server.json to seek it off
>>> the forwarded port. Shortly before it does time out, there's a window
>>> roughly 5 minutes in duration where I can successfully execute a "ssh -p
>>> 2022 localhost" from another terminal.
>>>
>>> The only theory I have is that somehow the SSH_Available checker is not
>>> using the SSH settings in the JSON. I've attached the preseed.cfg and the
>>> server.json for review. Thanks in advance!
>>>
>>> [root@centos-test ubuntu_64]# packr build server.json
>>> virtualbox-iso output will be in this color.
>>>
>>> ==> virtualbox-iso: Downloading or copying Guest additions
>>>     virtualbox-iso: Downloading or copying: file:
>>> ///usr/share/virtualbox/VBoxGuestAdditions.iso
>>> ==> virtualbox-iso: Downloading or copying ISO
>>>     virtualbox-iso: Downloading or copying: http://
>>> releases.ubuntu.com/14.04/ubuntu-14.04.4-server-amd64.iso
>>> ==> virtualbox-iso: Starting HTTP server on port 9001
>>> ==> virtualbox-iso: Creating virtual machine...
>>> ==> virtualbox-iso: Creating hard drive...
>>> ==> virtualbox-iso: Creating forwarded port mapping for communicator (
>>> SSH, WinRM, etc) (host port 2555)
>>> ==> virtualbox-iso: Executing custom VBoxManage commands...
>>>     virtualbox-iso: Executing: modifyvm server.local --memory 1536
>>>     virtualbox-iso: Executing: modifyvm server.local --cpus 1
>>>     virtualbox-iso: Executing: modifyvm server.local --natpf1 guest_ssh,
>>> tcp,,2022,,22
>>>     virtualbox-iso: Executing: modifyvm server.local --natpf1 postgres,
>>> tcp,,5432,,5432
>>>     virtualbox-iso: Executing: modifyvm server.local --natpf1
>>> tomcat_http,tcp,,8080,,8080
>>>     virtualbox-iso: Executing: modifyvm server.local --natpf1
>>> tomcat_https,tcp,,8443,,8443
>>> ==> virtualbox-iso: Starting the virtual machine...
>>> ==> virtualbox-iso: Waiting 20s for boot...
>>> ==> virtualbox-iso: Typing the boot command...
>>> ==> virtualbox-iso: Waiting for SSH to become available...
>>> ==> virtualbox-iso: Timeout waiting for SSH.
>>> ==> virtualbox-iso: Unregistering and deleting virtual machine...
>>> ==> virtualbox-iso: Deleting output directory...
>>> Build 'virtualbox-iso' errored: Timeout waiting for SSH.
>>>
>>> ==> Some builds didn't complete successfully and had errors:
>>> --> virtualbox-iso: Timeout waiting for SSH.
>>>
>>> ==> Builds finished but no artifacts were created.
>>>
>>>
>>> --
>>> 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/packer/issues
>>> IRC: #packer-tool on Freenode
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Packer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to packer-tool...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/packer-tool/d22f3ed9-697e-4f76-bed5-93579c9daed9%40googlegroups.com
>>> <https://groups.google.com/d/msgid/packer-tool/d22f3ed9-697e-4f76-bed5-93579c9daed9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> 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/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/582aea94-663d-4650-9e13-329b7bf6f9b8%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/582aea94-663d-4650-9e13-329b7bf6f9b8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CAHqq0ezaSALqP_53Brs0d7mp0hd5OUguGVJHuknOLFXun46Sag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to