Questions tagged [packer]

PACKER QUESTIONS MUST BE PROGRAMMING RELATED. Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.

"Packer is a modern tool that embraces best benefits. It's completely automated, simply run a packer build, no human touches it, Packer builds it for you. " - Mitchell Hashimoto (Creator)

Packer is an open source tool for creating identical machine images for multiple platforms from a single source configuration. Packer is lightweight, runs on every major operating system, and is highly performant, creating machine images for multiple platforms in parallel. Packer does not replace configuration management like Chef or Puppet. In fact, when building images, Packer is able to use tools like Chef or Puppet to install software onto the image.

A machine image is a single static unit that contains a pre-configured operating system and installed software which is used to quickly create new running machines. Machine image formats change for each platform. Some examples include AMIs for EC2, VMDK/VMX files for VMware, OVF exports for VirtualBox, etc.

Resources

852 questions
12
votes
6 answers

Troubleshooting failed packer build

I am just getting started with Packer, and have had several instances where my build is failing and I'd LOVE to log in to the box to investigate the cause. However, there doesn't seem to be a packer login or similar command to give me a shell. …
Tejay Cardon
  • 4,193
  • 2
  • 16
  • 31
11
votes
2 answers

How do I find out the boot command for Packer?

If I want to create a virtual machine image using Packer, one option is to download an operating system's ISO image and use that as the base for a custom setup. When doing this, one needs to provide the boot_command, which is an array of strings…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
10
votes
1 answer

How to copy a file to host during packer provisioning?

I would like to generate a public/private ssh key pair during packer provisioning and copy the files to the host machine. Is there a way to copy files out from the VM to the host using packer?
Tom Sweeney
  • 640
  • 1
  • 9
  • 19
9
votes
1 answer

Difference between hashicorp packer vs linuxkit

I have used hashicorp packer for building baked VM images. But was wondering linuxkit too do the same stuff I mean building the baked VM images with the only difference of being more container and kernel centeric. Want to know the exact difference…
mchawre
  • 10,744
  • 4
  • 35
  • 57
9
votes
1 answer

How to make EC2 user-data work on freshly built AMI, made with Packer

I can build AMI images just fine. But they've stopped working with EC2 User Data: There is user data: $ cat /tmp/user_data.sh #!/bin/bash touch /tmp/i_have_user_data /root/i_have_user_data And I can launch a plain Ubuntu image: aws ec2…
Julian Simpson
  • 607
  • 1
  • 5
  • 11
8
votes
2 answers

Create a Windows AMI with packer and ansible on AWS

I want to create an aws windows AMI with packer and ansible. I have tried many configuration, but I have still a problem of connection to the instance. Here is my packer conf : { "builders": [{ "type": "amazon-ebs", "access_key": "{{user…
elhostis
  • 1,067
  • 14
  • 32
8
votes
2 answers

How to use AWS roles with Packer to create AMIs

I'm currently building AMIs via Packer without a problem, but I am baking the AWS credentials into my scripts which is not what I want. Reading the Packer documentation they specify that if no credentials are found it can use an AWS role. I have…
David Ficociello
  • 2,489
  • 5
  • 15
  • 21
8
votes
2 answers

packer templates and conditional statements

I'd like to use conditional statements in the packer template at the "provisioners" stage. "provisioners": [ { "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'", "override": { "virtualbox-iso": { …
wwr
  • 327
  • 1
  • 4
  • 11
7
votes
1 answer

What's the difference between buildspec, appspec, and rolling my own AMI?

I'm fairly confused about how the buildspec.yml and the appspec.yml files differ from one another, aside from structure. It doesn't seem like the phase commands from my buildspec have much effect on the deployment environment, and there is similar…
d8aninja
  • 3,233
  • 4
  • 36
  • 60
7
votes
2 answers

Where does packer store the private key?

From ubuntu shell I ran below command, to talk to aws platform, to customise amazon ami(ami-9abea4fb): $ packer build -debug template.packer Debug mode enabled. Builds will not be parallelized. amazon-ebs output will be in this color. ==>…
overexchange
  • 15,768
  • 30
  • 152
  • 347
7
votes
1 answer

Packer build from a Gitlab pipeline

I am trying to execute my packer build into a Gitlab pipeline, i didn't find examples on the internet but i have seen there is a docker image, so i was hoping this yaml would do the job: image: hashicorp/packer stages: - build build: stage:…
Ludo
  • 5,060
  • 15
  • 53
  • 85
7
votes
3 answers

How to set a packer variable from a terraform state

Working with openstack. I have a two steps process to build images with packer: (1) create infrastructure using terraform basically, just a network routed to the internet and some security group that allows SSH (2) build the image using…
7
votes
3 answers

How can I copy an AMI to another account using Packer?

I have two AWS Accounts: Test Account Prod Account I am creating an AMI using Packer in the Test Account and want to copy the AMI to the Prod Account after that. How can I use Packer to do that and also remove the actual AMI after the job is…
user6457056
7
votes
2 answers

passwordless sudo using ubuntu preseed and packer

I am attempting to grant passwordless sudo privileges to a user created during Ubuntu 14.04 install. However when the image is created none of the changes related to sudo exist. Here are the relevant parts of the preseed file: # Create Vagrant…
6
votes
3 answers

Apt-get with Packer randomly failing

I'm using Packer to build an ami with a file ami.json that runs two provisioners built off the default Ubuntu Server 20.04 LTS image. The problem is Packer build randomly fails on apt-get install ansible with the error E: Unable to locate package…
Coupcoup
  • 179
  • 1
  • 8
1
2
3
56 57