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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/af009da8-6228-406a-8f72-53926c1d7a84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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.
On 22 May 2018 at 07:00, <s...@integrichain.com> 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 packer-tool...@googlegroups.com.
"provisioners": [
{
"type": "shell",
"inline": ["sudo apt-get -y update",
"sudo apt-get -y install software-properties-common",
"sudo apt-add-repository -y ppa:ansible/ansible",
"sudo apt-get -y update",
"sudo apt-get -y install ansible"]
},
{
"type": "ansible-local",
"playbook_file": "../ansible/playbook.yml"
}
]