I came to understand based on this: https://github.com/hashicorp/packer/issues/1731 that Packe works with provisioners at the first opportunity it has ssh available. It will pass the #boot-config script which runs at boot time, but by the time Packer finally has SSH access to the instance, it dives in and find that there is nothing to execute as there is no shell provisioner and thus abruptly ends the instance, not caring whether or not the #boot_config script is completed. I guess #boot_config is more suitable for the packages section and critical stuff at boot time, but to use it for creating directories, downloading files etc is not a good way of using Packer.
Issue resolved, thanks. On Friday, October 13, 2017 at 5:06:07 PM UTC-4, Kevin Johnson wrote: > > Hi, > > I just started using Packer for the first time > > I want to use it to create a custom AMI based on Amazon Linux AMI for > ElasticBeanstalk. > I want to use the base image and install erlang, elixir and Rserve on it. > For this purpose, I wrote a #cloud-config script to declare all the > dependencies under "packages:", and to declare all the instructions it > needs to execute, under "runcmd:", > so that packer during the build will download a 250mb file from > erlang.com/download, download a git repo for elixir and download R and > all its dependencies > > I have tested the #cloud-config script by launching an ec2 instance and > supplying it as user-data. Once I had it fully working, I proceeded to > supplement this script to packer by specifying a user_data_file > > The problem that I am experiencing is that packer stops the instance too > soon for my 250MB file to even get downloaded. The server only stays on for > like 20-30 seconds and then it abruptly ends it. > > Can someone explain to me why Packer is behaving in this way and what > potential workaround I may consider? > > Thanks in advance. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/097400a4-2f53-4c15-9327-0637d2b7631d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
