Create a VM using terraform on an Azure image created by Packer

Team, I need to provision an Azure VM (Windows/Linux) and I followed the below link to create the image first. https://docs.microsoft.com/en-us/azure/virtual-machines/windows/build-image-with-packer https://docs.microsoft.com/en-us/azure/virtual-machines/linux/build-image-with-packer Now, I have to provision the Virtual Servers from these images using Terraform. I am able to find the steps to create using a VHD with Terraform but not the managed image. Can … Read more

Adding arguments to Packer’s Ansible provisioner

My Friday brain is really struggling to convert an Ansible command line into the format my Packer .json wants. The Ansible: ansible-playbook playbook.yml -e @env/users/user01.yml –ask-vault –ask-become My attempted Packer block: “provisioners”: [ { “ansible_env_vars”: [“ANSIBLE_HOST_KEY_CHECKING=False”], “playbook_file”: “{{ template_dir }}/../path/playbook.yml”, “type”: “ansible”, “user”: “{{ user `ssh_username` }}”, “extra_arguments”: [“–extra-vars”, “@env”, “../path/env/users/user01.yml”, “desktop=false”, “–vault-password-file”, “../vaultpass”] } … Read more

No builder returned for name: vagrant Packer.io error

I just want to provision a standard Ubuntu 12.04 image with a shell script, and then package it so I can use it with Vagrant. This is the configuration I wrote: { “builders”: [{ “type”: “vagrant”, “iso_url”: “http://releases.ubuntu.com/12.04/ubuntu-12.04.3-server-amd64.iso”, “iso_checksum”: “2cbe868812a871242cdcdd8f2fd6feb9”, “iso_checksum_type”: “md5” }], “provisioners”: [{ “type”: “shell”, “script”: “bootstrap.sh” }], “post-processors”: [“vagrant”] } Unfortunately ‘packer … Read more

Chef installation in a chroot (packer): not starting services

I’m trying to use packer.io to create a machine image for a server who’s deployment I already have automated using Chef (chef-solo specifically), using the amazon-chroot builder and the chef-solo provisioner (with a few shell provisining steps wrapped around it for init / cleanup stuff). This method mounts an EBS volume somewhere on the system … Read more

How to configure ssh access for an unattended linux-distro ISO image for local development env similar to accessing cloud service VM instances?

I configured Packer to build unattended ISO installs of various Debian-derived distros to VMware fusion. As I configure the VMs manually for ssh access, it times out and the build artifacts created are erased. How do you go about pre-installing ssh access as part of an OS installation image similar to how its done for … Read more

Ansible not executing within Packer Build

I am currently experimenting with deploying using Packer’s Ansible local provisioning and for some odd reason, it doesn’t appear to be executing the tasks in the playbook. Packer, after installing the pre-requiresites for Ansible, uploads the following: Inventory file (“hosts”) [localhost] localhost ansible_connection=local And the playbook file (“local.yml”): — – hosts: localhost connection: local become: … Read more

How do I use debconf in salt with pillars?

I have the following: newrelic-debconf: debconf.set: – name: newrelic-php5 – data: ‘newrelic-php5/application-name’: { ‘type’: ‘string’, ‘value’: ‘{{ salt[‘pillar.get’](‘newrelic:applicationName’, ”) }}’ } ‘newrelic-php5/license-key’: { ‘type’: ‘string’, ‘value’: ‘{{ salt[‘pillar.get’](‘newrelic:licence’, ”) }}’ } it’s pretty straightforward, using salt masterless provisioner with packer. However, this state fails with: Rendering SLS ‘base:newrelic’ failed: Jinja syntax error: expected token ‘end … Read more

serverspec nginx should be listening using packer

I am using packer to build an ami on aws, after the provision of the ami, I am testing the image using serverspec, but the test fail testing nginx, this is the test cat test/spec/localhost/nginx_spec.rb 2.4.2 require ‘spec_helper’ describe package(‘nginx’), :if => os[:family] == ‘redhat’ do it { should be_installed } end describe service(‘nginx’), :if … Read more

xenserver-iso: Error downloading: open : no such file or directory

I’m trying to build a “vdi_vhd” image using packer on xenserver,but i have got the below error, could you please anyone help me on this,Thanks in advance. [root@localhost bin]# packer build /usr/local/test-scripts/main.json xenserver-iso output will be in this color. ==> xenserver-iso: XAPI client session established ==> xenserver-iso: Downloading or copying ISO xenserver-iso: Downloading or copying: … Read more

packer unable to parse json due to invalid character

I want to use packer to build an ami. The AMI was initially built by an aws_instance resource in terraform. It contains the following user_data <powershell> winrm quickconfig -q winrm set winrm/config/winrs ‘@{MaxMemoryPerShellMB=”300″}’ winrm set winrm/config ‘@{MaxTimeoutms=”1800000″}’ winrm set winrm/config/service ‘@{AllowUnencrypted=”true”}’ winrm set winrm/config/service/auth ‘@{Basic=”true”}’ netsh advfirewall firewall add rule name=”WinRM 5985″ protocol=TCP dir=in localport=5985 … Read more