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
3
votes
0 answers

How to add a role to the ec2 instance created by packer's amazon-ebs buiilder

Packer ebs-builder spins up an ec2 instance. Is it possible to attach a role to this ec2 instance? I want the role so that I can run some AWS cli commands in the user_data portion.
Massoom
  • 61
  • 3
3
votes
0 answers

caching packer intermediate "layers" to reduce total time to build

I'm using packer with a vmware-iso source and an ansible provisioner. As I'm tinkering with ansible to get things working, I end up running packer from the beginning which starts from the iso from scratch (e.g. downloading centos updates, etc). I…
user2987504
  • 547
  • 1
  • 5
  • 12
3
votes
2 answers

Configuring Packer with Neovim

I'm trying to switch over my current setup for Neovim (using Vim Plug) to Packer and I'm having trouble. My Neovim is loaded from ~/.config/nvim/init.lua which sources all of my plugin and other settings. They live mostly inside of a ~/lua folder…
Harrison Cramer
  • 3,792
  • 9
  • 33
  • 61
3
votes
1 answer

how to put AMI name in packer manifest

I would like to get the AMI name into the packer manifest. I understand how to get this for the AMI id but its different for the name. I have: data "amazon-ami" "ubuntu" { filters = { name =…
user1584120
  • 1,169
  • 2
  • 23
  • 44
3
votes
1 answer

Using variables as part of other variables values

I am trying to do some kind of parameterizatiim inside one of the pkrvars.hcl files. I would like to have urls pointing to some resource to be using some other variables, like: Lib_url = "https://lib-name-${version}` Where version comes from other…
Andrew
  • 47
  • 8
3
votes
1 answer

Packer giving me SCP permission denied when moving a redis.conf file over to an AMI

I am extremely confused on why this occurs when using Packer. What I want to do is move a local redis.conf file over to my AMI; however, it gives me an error as I do this. My Packer provisioner is like so: { "type": "file", "source":…
Roma
  • 535
  • 6
  • 18
3
votes
0 answers

packer hcl2 how to use locals in -var-file or alternative pattern

in my original json for packer it was easy to assemble variables which reference other variables. Now that packer recommends to use hcl2 i am wondering how to use this pattern (or antipattern in hcl2) . The basic run was packer build -var-file…
Mandragor
  • 4,684
  • 7
  • 25
  • 40
3
votes
2 answers

what does "Owner" field in packer "source_ami_filter" work on?

i am new packer and exploring few things on it while using it something like this came up "builders": [ { "type": "amazon-ebs", "profile" : "sumanthdev", "region": "us-east-1", "source_ami_filter": { "filters":…
sumanth shetty
  • 1,851
  • 5
  • 24
  • 57
3
votes
3 answers

How do you manage image versions with Packer and Terraform?

I'm currently using a Kubernetes cluster running on bare metal nodes provisioned with Ansible. There are plans to move to the cloud and I'm reading about Terraform and Packer, in preparation for this. Leaving the data migration aside, it seems like…
Erik B
  • 40,889
  • 25
  • 119
  • 135
3
votes
0 answers

Why is esc and bs used in Packer boot_command?

I am trying to learn Packer making it possible for me to create templates/golden images for my VMs. In the long run, I want to be able to have Packer in CI/CD pipeline constantly updating images for my VMs. Now I am trying to create an image for an…
user17378
  • 123
  • 1
  • 5
3
votes
1 answer

packer provisioning by ansible fails in aws codebuild

My Codebuild project that it creates AMI by packer by ansible provisioner. This packer settings success in my local environment and Amazon linux2 ec2 environment. However, when I use AWS Codebuild with aws/codebuild/amazonlinux2-x86_64-standard:1.0…
db099u
  • 505
  • 1
  • 5
  • 12
3
votes
0 answers

Instance launched from custom AMI fails to launch when installing python modules using Python 3.7

I'm creating a custom Ubuntu AMI using Packer and then using it to launch an EC2 instance, which then has an application deployed to it using CodeDeploy. On this instance I need to use Python3.7 as I'm using some datetime functionality that isn't…
Slushysnowman
  • 438
  • 2
  • 9
3
votes
1 answer

How to pass an attribute from a packer build to a chef coobook?

I am trying to pre-set a chef-attribute from a packer build but I can't seem to get it work: "provisioners": [ { "chef_environment": "test_cookbook", "environments_path": "environments", "execute_command": "{{if…
user_dev
  • 1,357
  • 3
  • 20
  • 46
3
votes
1 answer

Using Hashicorp Packer with Vault Secret Engine KV2

I'm trying to use packer with vault secret engine kv2, but so far I'm hitting an auth/permission error. I'm trying to read a secret from vault, as shown in the examples. In my test.json file I have a variables object, and inside I have an access_key…
alexandernst
  • 14,352
  • 22
  • 97
  • 197
3
votes
1 answer

Ubuntu 18.04.1 on VMware Fusion 11 results in kernel panic with Packer

I am trying to create a VMware virtual machine using Packer, with Ubuntu Server 18.04.1 as guest OS. However, creation of the VM fails after having sent the boot command. The specific error seems to be related to APIC, although the boot command…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425