packer
Archived0224
Discuss Packer for building AMIs and Docker Images
Archive: https://archive.sweetops.com/packer/
erikover 1 year ago
archived the channel
Heath Snowover 2 years ago
Ah, nevermind:
> Users are encouraged to use the shell or shell-local provisioner to run the provisioning tools made available by this plugin
Heath Snowover 2 years ago
What are folks using for post provisioning tests? I used Inspec in the past but I see the provisioner has been archived:
• https://github.com/hashicorp/packer-plugin-inspec
• https://github.com/hashicorp/packer-plugin-inspec
Dhamodharanover 2 years ago
I am trying to build an AMI, but i am taking the previous build AMI as source, On the top of that AMI, i want to update some additional packages and some folder needs to create, but when i run the packer command second time, its failing with the folder already exist.
Is there a way to check the folder and if its available, need to skip that provisioner step.
Can someone help me to add that step and ignore if its already available.?
Regards,
Is there a way to check the folder and if its available, need to skip that provisioner step.
Can someone help me to add that step and ignore if its already available.?
Regards,
Dhamodharanover 2 years ago
hi #packer team,
Matthew Jamesalmost 3 years ago
anyone tried adapting null-label to packer hcl? found myself writing quite a few packer files and the null-label would be kinda nice to translate for generation of tags ami naming convetions etc
Lorgio Jimenezover 3 years ago(edited)
Hello all 👋
I have a question that I have not been able to properly google.
Is there any way to import (upto a point) an amazon generated AMI into packer? I’m dealing with something that was manually created, and i’m trying to “codify” it as much as possible.
I have a question that I have not been able to properly google.
Is there any way to import (upto a point) an amazon generated AMI into packer? I’m dealing with something that was manually created, and i’m trying to “codify” it as much as possible.
jonjitsuover 3 years ago
I'm curious how people are organizing their packer code. Do you have a general packer repo with all packer builds within? Do you have one repo per packer build? Or is the packer build contained with the code repo similar to the docker way?
Joe Perezabout 4 years ago
Hello all, just wanted to share my post on Packer if you haven't seen it yet: https://www.taccoform.com/posts/pkr_p1/
Nikolai Momotabout 4 years ago
I've been experiencing the weirdest issue with Packer:
• Running a build on a Windows image in
• Changing the region to
• I've been able to recreate this with the tutorial from the Packer docs
Has anyone run into this as well? Can anyone recreate this on their end?
I first noticed this yesterday and felt like I was going insane
• Running a build on a Windows image in
ca-central-1 has issues with WinRM where it's unable to connect and times out• Changing the region to
us-east-1 immediately resolves the issue• I've been able to recreate this with the tutorial from the Packer docs
Has anyone run into this as well? Can anyone recreate this on their end?
I first noticed this yesterday and felt like I was going insane
Saichovskyover 4 years ago
But I’m getting this error message instead:
Error: Failed preparing provisioner-block "shell" ""
on jenkins-slave-ami.pkr.hcl line 87:
(source code not available)
render 'environment_vars': template: root:1:20: executing "root" at <user
`AWS_SESSION_TOKEN`>: error calling user: test in:
AWS_SESSION_TOKEN={{user `AWS_SESSION_TOKEN`}}Saichovskyover 4 years ago
Why won’t this work? I need to pass environment variables from my laptop’s CLI to the provisioner, so that they can be printed out by the
test_script.sh scriptSaichovskyover 4 years ago
provisioner "shell" {
environment_vars = [
"AWS_SESSION_TOKEN={{user `AWS_SESSION_TOKEN`}}",
"AWS_ACCESS_KEY_ID={{user `AWS_ACCESS_KEY_ID`}}",
"AWS_SECRET_ACCESS_KEY={{user `AWS_SECRET_ACCESS_KEY`}}",
"AWS_SECURITY_TOKEN={{user `AWS_SECURITY_TOKEN`}}"
]
script = "test_script.sh"
}Saichovskyover 4 years ago
Hey guys,
Need some packer help
Need some packer help
Joaquin Menchacaover 4 years ago
Any examples out there for a multi-stage Dockerfile in Packer? I want to have a build containers, npm assets for frontend, backend golang, and final layer that copies the directory or binaries from previous stages to the final image.
Thayne Trevenenalmost 5 years ago
Hey Packer Peeps, I have been using packer for a year at an old company and it worked flawlessly however I am at a new company with restrictions on AWS security groups and any SG created with wide open access is automagically deleted. Therefore when packer try's to do anything via ssh over port 22 and the temp SG [0.0.0.0\0] packer times out waiting for ssh access. Does anyone know of a way to specify something other than [0.0.0.0\0] in the packer file?
Garethover 5 years ago(edited)
Hello,
I've many windows packer jobs that have been running for many months and even years in some cases.
We've always had the odd winrm issue where it never connects but normally rerunning the packer job works without any adjustment. However, over the last week. our success rates have dropped to around 1 in 8 runs being successful. I've historically used the winrm enablement example code from https://www.packer.io/docs/communicators/winrm
but noticed this week that there is a new recommendation to not use quick config and use a different approach
https://learn.hashicorp.com/tutorials/packer/getting-started-build-image#warning
Using the exact copy of the latter script hasn't yet shown any improvement in success rates. I'm using the windows 2016 base image from MS and the standard AWS ebs builder configuration. I've also tried the latest packer version. Before I start a deep dive on one of the failing image I'd like to ask if anybody has experienced similar issues or maybe converted to using ssh and found it more reliable? I'd really welcome your thoughts.
I've many windows packer jobs that have been running for many months and even years in some cases.
We've always had the odd winrm issue where it never connects but normally rerunning the packer job works without any adjustment. However, over the last week. our success rates have dropped to around 1 in 8 runs being successful. I've historically used the winrm enablement example code from https://www.packer.io/docs/communicators/winrm
but noticed this week that there is a new recommendation to not use quick config and use a different approach
https://learn.hashicorp.com/tutorials/packer/getting-started-build-image#warning
Using the exact copy of the latter script hasn't yet shown any improvement in success rates. I'm using the windows 2016 base image from MS and the standard AWS ebs builder configuration. I've also tried the latest packer version. Before I start a deep dive on one of the failing image I'd like to ask if anybody has experienced similar issues or maybe converted to using ssh and found it more reliable? I'd really welcome your thoughts.
RBover 5 years ago
Packer hcl is almost complete https://github.com/hashicorp/packer/issues/9176
Only
Only
packer fix and packer fmt is leftzadkielover 5 years ago
I'd like to create an AMI from a ISO file. I've found that I had to follow this path: iso -> ova/qcow2 -> ami
Have you seen any guide for building this kind of workflow?
Thank you
Have you seen any guide for building this kind of workflow?
Thank you
Abel Luckover 5 years ago
Is there terminology for an image that has software installed but no stage specific settings? Likewise for an image that has software installed and is pre-baked with stage specific settings?
Chris Fowlesalmost 6 years ago
with automation and cheap storage amis need to be less golden. it makes much more sense to build a more specific ami
RBalmost 6 years ago
How does everyone here create golden amis with toggles ? such as if you want instance X to use AMI1 with datadog and instance Y to use AMI1 without datadog, you wouldn't build a whole new AMI, you'd have some kind of flag or feature toggle, right?
Would love to here thoughts on this. I'm wondering if we can do something with SSM or tagging on instances to use as toggles.
Would love to here thoughts on this. I'm wondering if we can do something with SSM or tagging on instances to use as toggles.
johnnymalmost 6 years ago
@johnnym has joined the channel
RBalmost 6 years ago
is there a packer linter ?
Sai Krishnaalmost 6 years ago
Hi Everyone - How do I set image name in packer docker image builder script?
RBalmost 6 years ago
Anyone use hcl for packer?
Pierre Humberdrozalmost 6 years ago(edited)
Hey I am trying to pass 2 env vars from a ci pipeline to my shell provisioner somehow this does not seems to work.
RESOURCES_AWS_ACCESS_KEY_ID and RESOURCES_AWS_SECRET_ACCESS_KEY my packer json is in the threadAbel Luckabout 6 years ago
Anyone seen/used https://github.com/wata727/packer-post-processor-amazon-ami-management ?
RBabout 6 years ago
anyone know how to retrieve the source ami date ?
ikarabout 6 years ago
cool 😎 thanks!
Abel Luckabout 6 years ago
haven't had time to try out HCL with packer yet
Abel Luckabout 6 years ago
i've only used JSON with packer
ikarabout 6 years ago
oh, good idea! you use HCL or JSON for that?
Abel Luckabout 6 years ago
make your 1 param an env var in the packer json, and then write a Makefile that sets the var and calls packer once for each value
Abel Luckabout 6 years ago
I usually use a Makefile with an environment variable to build AMIs dynamically with packer
ikarabout 6 years ago
Hi there!
haven't done my research yet, but quite curious about HCL & packer - is it possible to "import modules"? I'll have about 5 AMIs to pack and all JSONs look the same except for 1 parameter.
Anyone have a solution? 🙂
haven't done my research yet, but quite curious about HCL & packer - is it possible to "import modules"? I'll have about 5 AMIs to pack and all JSONs look the same except for 1 parameter.
Anyone have a solution? 🙂
Erik Osterman (Cloud Posse)about 6 years ago
Adding @U010XGY9B46 bot
Jason Walshabout 6 years ago
Hi all. Last weekend I started a small project that is a web user interface for generating Packer templates. The project is still in its infancy and has a lot of room for improvement, but I'd love to get some feedback. The source code is here: https://github.com/jasonwalsh/punk.
ikarabout 6 years ago
Thanks @David! This is exactly what I needed to see 😉
Helped me building my (slightly simpler) python script 😃
Helped me building my (slightly simpler) python script 😃
Davidabout 6 years ago
If you want to do it in a script, here's a ts-node script I wrote yesterday that runs a command on each instance to gracefully kill its process, then shuts down the instance, then waits for a new healthy instance to come up, then repeats with all other nodes until all nodes have been cycled.
The commands in python would likely be very similar
The commands in python would likely be very similar
ikarabout 6 years ago(edited)
so in other words: do you usually run terraform programmatically? based on some external events?
ikarabout 6 years ago
Hey there!
I'm about to build (AWS) AMIs via crontab on one of our service machine. Afterwards I'll update Lanch conf + autoscaled group with python and boto3.
How do you "rotate" the machines in the autoscaled group?
I know terraform can be used fot this, but I feel like i don't want to run terraform automatically. Not quite sure why. The only concern is it should also commit TF state changes - I know, this is not recommended way how to store state, shame on me.
I'm about to build (AWS) AMIs via crontab on one of our service machine. Afterwards I'll update Lanch conf + autoscaled group with python and boto3.
How do you "rotate" the machines in the autoscaled group?
I know terraform can be used fot this, but I feel like i don't want to run terraform automatically. Not quite sure why. The only concern is it should also commit TF state changes - I know, this is not recommended way how to store state, shame on me.
Erik Osterman (Cloud Posse)over 6 years ago
@UUB28NLDS help keep tabs! 😉
Alexander Tolstikovover 6 years ago
Mike Whitingover 6 years ago
I'm getting weird Go lang array type errors back when the processor is run and I have to do a complete vagrant-iso build each time to test it
Mike Whitingover 6 years ago(edited)
does anyone know if it's possible to run a 'vagrant-cloud' post-processor in isolation (after an asset is built) ?
James Woolfendenover 6 years ago
I made this https://slalom-consulting-ltd.github.io/learn-packer/ . If it's useful or missing something let me know. Ta.
Brandon Wilsonover 6 years ago
Anyone here use the checksum post processor to tag docker images with the checksum? Trying to figure this out