Hot answers tagged

24

This sequence of commands works for me: apt-get update DEBIAN_FRONTEND=noninteractive apt-get upgrade -yq So, DEBIAN_FRONTEND=noninteractive is correct but you also need the -q flag. Source: https://github.com/moby/moby/issues/4032


11

Your problem is that grub file change adhere to ucf and not debconf, as per this incident on apt list you're not alone. As workaround I found this answer on askunbuntu. Removing the menu.lst from the UCF configuration system should be enough, for your case: "provisioners": [ { "type": "shell", "inline": [ "sudo ucf --purge /boot/grub/menu....


9

Mainly the reason is to keep your image building steps intact if you get to move from docker to another image building system. Packer does support a bunch of providers (builders in packer terminology), and changing the target "container" is just a matter of changing the builder (or using multiple builders in the same packer file), the build steps (...


6

The PR you are linking to contains a link to a python script that does exactly this, since you can run that script from anywhere you can access your Jenkins server.


6

Part of adopting the Immutable Infrastructure Pattern is decomposing your system into small manageable pieces that can move through CI/CD Pipeline very quickly, this means that OS patches can be done quickly and in a controlled manner. I often see clients ending up with a halfway house where infrastructure is mostly immutable. However, there are a few ...


5

You may use matchbox on a VM as you do on a baremetal machine, you won't be able to use packer on a baremetal machine ont he other hand as it doesn't handle any PXE boot option. That said, leveraging vSphere/AWS/ API/cli to create a new machine from a template is usually quicker and more effective than using the API/cli to create the VM and then make it ...


5

An idea key to your question is that of immutable infrastructure, which is the idea that an image is built once, deployed many times, and never changed at runtime. If the contents of the image need to change, an entirely new image is built from scratch and new instances replace the ones running the old image. This is the opposite of what you might now call ...


5

And then I start like this docker run -p 21:21 -it --rm 52c0b0362362 bash This would not work by design. When you run the image with the command above you are instructing Docker to overwrite the CMD instruction from your Dockerfile and therefore telling it to execute bash instead of sudo myprogram. It doesn't matter what you have set in the CMD instruction -...


3

I don't know of a way to get the actual GCE VM images. But it's possible to export the images to GCS (as a tar.gz archive): If you need to move your Compute Engine boot disk data outside of your Compute Engine project, you can export a boot disk image to Cloud Storage as a tar.gz file. You can export a custom image as backup or for sharing by ...


3

It appears that you are trying to run ansible locally inside the container but instead you are running it locally on the machine you use to run packer on(the provisioning one). To run ansible in local mode you need to update the ansible part of your packer file to: { "type": "ansible-local", "playbook_file": "./kubeadm.yml" } Also, ...


3

Packer has taken an active decision not to build in such capabilities. This problem is much better solved by other tools such as jq, etc. We think the best way to leverage Packer is to wrap it if you need more ways to create the template. It's very easy to create json in any programming language which gives you unlimited expressiveness when creating ...


3

Updated the python script from the PR above with: CSRF support to work better with Jenkins 2.x full support for private Jenkins jobs Also I wrote up some usage instructions.


3

To add to Philipp's answer, if you are using sudo then you need to make sure to set the DEBIAN_FRONTEND variable afterwards, like so: apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -yq


3

Image generation and distribution quickly rises to O(n^2) or higher, and as terraform is explicitly focused on instantiation it relies on external provisioners for internal state. It will work at a smaller scale, but will greatly complicate a hybrid-cloud model and will have problems if the systems are long lived. It also tends to cause difficulties with ...


3

Problems with golden images are that you have to store a full system image with overhead of data which is not build-specific, and using conventions for configuration to make deploy process the same for all versions. TL;DR: Infrastructure as a Code, version-specific storage for data outside the app package. The problem is easily solved by storing config ...


3

Try piping your output to grep and then failing based off of the return code of grep: npm install 2>&1 | grep "Error: connect ETIMEDOUT" Per the grep documentation, the exit status is 0 if a line is selected, 1 if no lines were selected, and 2 if an error occurred. If needed, you can "not" the return code or just invert the conditional so that: ...


3

I am less familiar with what Azure offers, but other cloud providers offer a way to manage users external to the VMs the provide (normally IAM permissions). I would not bake user into the system but look for an external way to manage them. This allows you to more easily remove users that leave your company or add new users that join. If Azure doesn't ...


3

I would agree with previous statements: avoid baking users into your base image with Packer. Likewise, you should avoid baking them with Terraform as well. Terraform does not provide a mechanism to perform on-going changes after the server is provisioned. It only has those initial provisioning scripts that get run only one time. If you manage users with ...


3

As it says, No such file or directory: 'gpg', so you probably need to install gnupg before adding the PPA repository: apt-get install gnupg


2

I avoid "baking" user accounts into my OS image with Packer unless there is an OS specific need for it. For example, a service or system account that is needed across all of my deployments. My suggestion is to use a Terraform provisioner to create the user accounts. That way you can change them when deploying the VMs via Terraform without having to create ...


2

So far, I've taken to defining the default builders and provisioners we use, with user variables interpolated in where required, eg: "type": "amazon-ebs", "instance_type": "t2.micro", "ami_name": "{{ user `ami-name` }} I've got files called eg. packer-builders.json and packer-provisioners.json, and then all the separate Packer templates in their own ...


2

First, make sure that packer runs in debug mode (packer build -debug ...), otherwise the temporary key will not be written to disk but will only be kept in memory. packer will store the key in its working directory. In other words, look in the same directory from which you started the packer process. If you use AWS, the file will be called ec2_amazon-ebs....


2

It looks like that there is a name conflict: The name of your virtual machine couldn't be set because VirtualBox is reporting another VM with that name already exists. Most of the time, this is because of an error with VirtualBox not cleaning up properly. To fix this, verify that no VMs with that name do exist (by opening the VirtualBox GUI). If they don't, ...


2

With a bridged adapter, your VM would get its IP from the host machine's network DHCP server. This would allow it to be pinged from your internal network. I'd also specify in your configuration that your cable is connected as so: VBoxManage modifyvm "VM" --cableconnected1 on Port forwarding in the VM's configuration would also work. It would allow access ...


1

The first thing I can recommend for you is to remove all of the manual steps in your deployment pipeline. DevOps is all about automating as much as possible to allow for fast, frequent, and safe deployment of your infrastructure. Second, if you haven't already, I would recommend using a build and deployment tool (Jenkins, Bamboo, GitLabCI, etc.) to compile ...


1

Packer doesn't support compression natively with iso_url, in this sample (Virtualbox builder) doc you can see that compression is not mentioned. So either you continue with your current solution, or you can also, look at extending packer to include this functionality.


1

I tried the dumbest approach, i.e. just to plug the iso.xz file into iso_url and see what happens. Of course, this failed (even after manipulating the iso extension key). What I ended up doing --- knowing a lot about Bash scripting, and not much about Packer, Go and the like --- is to wrap packer calls in a script that downloads and decompresses the image, ...


1

It seems that there is some bug in Hashicorps Packer 1.2.0, consider downgrading or upgrading to v1.2.1, comments in GH issue page confirm that the deployed fix is working.


1

What about using a CI tool? Create a parallel job and the jobs will run parallel. For example, one could use Jenkins: https://jenkins.io/blog/2017/09/25/declarative-1/ stage('run-parallel-branches') { steps { parallel( a: { echo "This is branch a" }, b: { echo "This is branch b" } ) } } but there are ...


1

I agree with others not to bake user accounts into the OS images. Especially personal user accounts of your infrastructure team should be maintained with a decent user management. There are only very rare circumstances where you want to system/service account to be installed everywhere. Reason: Getting users into the systems is most times easy because ...


Only top voted, non community-wiki answers of a minimum length are eligible