User data 1) is used by cloud-init 2). Cloud init is a service that
executes early in the boot process and reads user-data (among other things)
and can modify the VM's setup. It can add users and ssh-keys to allow
connection via ssh. But it's not guaranteed to finish before sshd starts,
so there is no strict order.

I sugest that you read the references, Google and get back if you get any
more specific follow up questions.

// Rickard

1) https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

2) http://cloudinit.readthedocs.io/en/latest/

On 22 May 2018 at 07:00, <[email protected]> wrote:

> So I have a bash script that installs a few things before my ansible-local
> run within the provisioner block. My intial draft I had a shell provisioner
> that would run my bash script. It works fine and ansible runs fine. I
> learned about user_data_file and decided to move this initial shell script
> out of the provisioner and set it as a user_data_file. It doesn't seem to
> work because I have it installing ansible on the image Packer is building
> in order to run the ansible-local provisioner.
>
> Does user_data_file run at the end before it snapshots the image or does
> it run BEFORE the provisioner starts?
>
> --
> 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/af009da8-6228-406a-8f72-53926c1d7a84%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/af009da8-6228-406a-8f72-53926c1d7a84%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALz9Rt-BbpdP%3DPVYStOyYpezOHNkK7a7KpqJRka6yxbfgX7_Wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to