{
  "builders": [
    {
      "communicator": "ssh",
      "disable_vnc": "True",
      "format": "{{user `format`}}",
      "headless": "{{user `headless`}}",
      "http_directory": "{{user `http_directory`}}",
      "http_port_max": "{{user `http_port_max`}}",
      "http_port_min": "{{user `http_port_min`}}",
      "name": "vmware-vmx",
      "output_directory": "{{user `output_dir`}}",
      "remote_datastore": "{{user `remote_datastore`}}",
      "remote_host": "{{user `remote_host`}}",
      "remote_password": "{{user `remote_password`}}",
      "remote_type": "{{user `remote_type`}}",
      "remote_username": "{{user `remote_username`}}",
      "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S -E sh -c 'usermod -L {{user `ssh_username`}} && {{user `shutdown_command`}}'",
      "skip_compaction": "{{user `skip_compaction`}}",
      "source_path": "{{ user `source_path`}}",
      "ssh_password": "{{user `ssh_password`}}",
      "ssh_timeout": "4h",
      "ssh_username": "{{user `ssh_username`}}",
      "type": "vmware-vmx",
      "vm_name": "{{user `build_version`}}",
      "vmx_data": {
        "ethernet0.networkName": "{{user `network`}}"
      },
      "vnc_bind_address": "{{user `vnc_bind_address`}}",
      "vnc_disable_password": "{{user `vnc_disable_password`}}",
      "vnc_port_max": "{{user `vnc_port_max`}}",
      "vnc_port_min": "{{user `vnc_port_min`}}"
    },
    {
      "boot_command": [
        "{{user `boot_command_prefix`}}",
        "{{user `boot_media_path`}}",
        "{{user `boot_command_suffix`}}"
      ],
      "boot_wait": "{{user `boot_wait`}}",
      "communicator": "ssh",
      "cores": "{{user `cpu_cores`}}",
      "cpus": "{{user `cpu`}}",
      "disk_adapter_type": "scsi",
      "disk_size": "{{user `disk_size`}}",
      "disk_type_id": "{{user `disk_type_id`}}",
      "floppy_dirs": "{{ user `floppy_dirs`}}",
      "format": "{{user `format`}}",
      "guest_os_type": "{{user `guest_os_type`}}",
      "headless": "{{user `headless`}}",
      "http_directory": "{{ user `http_directory`}}",
      "http_port_max": "{{user `http_port_max`}}",
      "http_port_min": "{{user `http_port_min`}}",
      "iso_checksum": "{{user `iso_checksum_type`}}:{{user `iso_checksum`}}",
      "iso_url": "{{user `iso_url`}}",
      "memory": "{{user `memory`}}",
      "name": "vmware-iso-base",
      "output_directory": "{{user `base_output_dir`}}",
      "remote_datastore": "{{user `remote_datastore`}}",
      "remote_host": "{{user `remote_host`}}",
      "remote_password": "{{user `remote_password`}}",
      "remote_type": "{{user `remote_type`}}",
      "remote_username": "{{user `remote_username`}}",
      "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S -E sh -c '{{user `shutdown_command`}}'",
      "skip_compaction": "{{user `skip_compaction`}}",
      "ssh_password": "{{user `ssh_password`}}",
      "ssh_timeout": "4h",
      "ssh_username": "{{user `ssh_username`}}",
      "type": "vmware-iso",
      "version": "{{user `vmx_version`}}",
      "vm_name": "{{user `base_build_version`}}",
      "vmdk_name": "{{user `base_build_version`}}",
      "vmx_data": {
        "ethernet0.networkName": "{{user `network`}}"
      },
      "vnc_bind_address": "{{user `vnc_bind_address`}}",
      "vnc_disable_password": "{{user `vnc_disable_password`}}",
      "vnc_port_max": "{{user `vnc_port_max`}}",
      "vnc_port_min": "{{user `vnc_port_min`}}"
    },
    {
      "boot_command": [
        "{{user `boot_command_prefix`}}",
        "{{user `boot_media_path`}}",
        "{{user `boot_command_suffix`}}"
      ],
      "boot_wait": "{{user `boot_wait`}}",
      "communicator": "ssh",
      "cores": "{{user `cpu_cores`}}",
      "cpus": "{{user `cpu`}}",
      "disk_adapter_type": "scsi",
      "disk_size": "{{user `disk_size`}}",
      "disk_type_id": "{{user `disk_type_id`}}",
      "floppy_dirs": "{{ user `floppy_dirs`}}",
      "format": "{{user `format`}}",
      "guest_os_type": "{{user `guest_os_type`}}",
      "headless": "{{user `headless`}}",
      "http_directory": "{{ user `http_directory`}}",
      "http_port_max": "{{user `http_port_max`}}",
      "http_port_min": "{{user `http_port_min`}}",
      "iso_checksum": "{{user `iso_checksum_type`}}:{{user `iso_checksum`}}",
      "iso_url": "{{user `iso_url`}}",
      "memory": "{{user `memory`}}",
      "name": "vmware-iso",
      "output_directory": "{{user `output_dir`}}",
      "remote_datastore": "{{user `remote_datastore`}}",
      "remote_host": "{{user `remote_host`}}",
      "remote_password": "{{user `remote_password`}}",
      "remote_type": "{{user `remote_type`}}",
      "remote_username": "{{user `remote_username`}}",
      "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S -E sh -c 'usermod -L {{user `ssh_username`}} && {{user `shutdown_command`}}'",
      "skip_compaction": "{{user `skip_compaction`}}",
      "ssh_password": "{{user `ssh_password`}}",
      "ssh_timeout": "4h",
      "ssh_username": "{{user `ssh_username`}}",
      "type": "vmware-iso",
      "version": "{{user `vmx_version`}}",
      "vm_name": "{{user `build_version`}}",
      "vmdk_name": "{{user `build_version`}}",
      "vmx_data": {
        "ethernet0.networkName": "{{user `network`}}"
      },
      "vnc_bind_address": "{{user `vnc_bind_address`}}",
      "vnc_disable_password": "{{user `vnc_disable_password`}}",
      "vnc_port_max": "{{user `vnc_port_max`}}",
      "vnc_port_min": "{{user `vnc_port_min`}}"
    },
    {
      "CPUs": "{{user `cpu`}}",
      "RAM": "{{user `memory`}}",
      "boot_command": [
        "{{user `boot_command_prefix`}}",
        "{{user `boot_media_path`}}",
        "{{user `boot_command_suffix`}}"
      ],
      "boot_wait": "{{user `boot_wait`}}",
      "cluster": "{{user `cluster`}}",
      "communicator": "ssh",
      "convert_to_template": "{{user `convert_to_template`}}",
      "cpu_cores": "{{user `cpu_cores`}}",
      "create_snapshot": "{{user `create_snapshot`}}",
      "datacenter": "{{user `datacenter`}}",
      "datastore": "{{user `datastore`}}",
      "disk_controller_type": "{{user `disk_controller_type`}}",
      "firmware": "{{user `firmware`}}",
      "floppy_dirs": "{{ user `floppy_dirs`}}",
      "folder": "{{user `folder`}}",
      "guest_os_type": "{{user `vsphere_guest_os_type`}}",
      "host": "{{user `host`}}",
      "http_directory": "{{ user `http_directory`}}",
      "http_port_max": "{{user `http_port_max`}}",
      "http_port_min": "{{user `http_port_min`}}",
      "insecure_connection": "{{user `insecure_connection`}}",
      "iso_checksum": "{{user `iso_checksum_type`}}:{{user `iso_checksum`}}",
      "iso_urls": "{{user `iso_url`}}",
      "name": "vsphere-iso-base",
      "network_adapters": [
        {
          "network": "{{user `network`}}",
          "network_card": "{{user `network_card`}}"
        }
      ],
      "password": "{{user `password`}}",
      "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S -E sh -c '{{user `shutdown_command`}}'",
      "ssh_clear_authorized_keys": "false",
      "ssh_password": "{{user `ssh_password`}}",
      "ssh_timeout": "4h",
      "ssh_username": "{{user `ssh_username`}}",
      "storage": [
        {
          "disk_size": "{{user `disk_size`}}",
          "disk_thin_provisioned": "{{user `disk_thin_provisioned`}}"
        }
      ],
      "type": "vsphere-iso",
      "username": "{{user `username`}}",
      "vcenter_server": "{{user `vcenter_server`}}",
      "vm_name": "{{user `base_build_version`}}",
      "vm_version": "{{user `vmx_version`}}"
    },
    {
      "CPUs": "{{user `cpu`}}",
      "RAM": "{{user `memory`}}",
      "boot_command": [
        "{{user `boot_command_prefix`}}",
        "{{user `boot_media_path`}}",
        "{{user `boot_command_suffix`}}"
      ],
      "boot_wait": "{{user `boot_wait`}}",
      "cluster": "{{user `cluster`}}",
      "cd_files": ["{{user `cd_file_path`}}/meta-data", "{{user `cd_file_path`}}/user-data"],
      "cd_label": "cidata",
      "communicator": "ssh",
      "convert_to_template": "{{user `convert_to_template`}}",
      "cpu_cores": "{{user `cpu_cores`}}",
      "datacenter": "{{user `datacenter`}}",
      "datastore": "{{user `datastore`}}",
      "destroy": true,
      "disk_controller_type": "{{user `disk_controller_type`}}",
      "export": {
        "force": true,
        "manifest": "{{ user `export_manifest`}}",
        "output_directory": "{{user `output_dir`}}"
      },
      "firmware": "{{user `firmware`}}",
      "floppy_dirs": "{{ user `floppy_dirs`}}",
      "folder": "{{user `folder`}}",
      "guest_os_type": "{{user `vsphere_guest_os_type`}}",
      "host": "{{user `host`}}",
      "http_directory": "{{ user `http_directory`}}",
      "http_port_max": "{{user `http_port_max`}}",
      "http_port_min": "{{user `http_port_min`}}",
      "insecure_connection": "{{user `insecure_connection`}}",
      "iso_checksum": "{{user `iso_checksum_type`}}:{{user `iso_checksum`}}",
      "iso_urls": "{{user `iso_url`}}",
      "name": "vsphere",
      "network_adapters": [
        {
          "network": "{{user `network`}}",
          "network_card": "{{user `network_card`}}"
        }
      ],
      "password": "{{user `password`}}",
      "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S -E sh -c '{{user `shutdown_command`}}'",
      "ssh_password": "{{user `ssh_password`}}",
      "ssh_timeout": "4h",
      "ssh_username": "{{user `ssh_username`}}",
      "storage": [
        {
          "disk_size": "{{user `disk_size`}}",
          "disk_thin_provisioned": "{{user `disk_thin_provisioned`}}"
        }
      ],
      "type": "vsphere-iso",
      "username": "{{user `username`}}",
      "vcenter_server": "{{user `vcenter_server`}}",
      "vm_name": "{{user `build_version`}}",
      "vm_version": "{{user `vmx_version`}}"
    },
    {
      "CPUs": "{{user `cpu`}}",
      "RAM": "{{user `memory`}}",
      "cluster": "{{user `cluster`}}",
      "communicator": "ssh",
      "convert_to_template": "{{user `convert_to_template`}}",
      "cpu_cores": "{{user `cpu_cores`}}",
      "create_snapshot": "{{user `create_snapshot`}}",
      "datacenter": "{{user `datacenter`}}",
      "datastore": "{{user `datastore`}}",
      "export": {
        "force": true,
        "manifest": "{{ user `export_manifest`}}",
        "output_directory": "{{user `output_dir`}}"
      },
      "folder": "{{user `folder`}}",
      "host": "{{user `host`}}",
      "insecure_connection": "{{user `insecure_connection`}}",
      "linked_clone": "{{user `linked_clone`}}",
      "name": "vsphere-clone",
      "network": "{{user `network`}}",
      "password": "{{user `password`}}",
      "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S -E sh -c 'usermod -L {{user `ssh_username`}} && {{user `shutdown_command`}}'",
      "ssh_password": "{{user `ssh_password`}}",
      "ssh_timeout": "4h",
      "ssh_username": "{{user `ssh_username`}}",
      "template": "{{user `template`}}",
      "type": "vsphere-clone",
      "username": "{{user `username`}}",
      "vcenter_server": "{{user `vcenter_server`}}",
      "vm_name": "{{user `build_version`}}"
    }
  ],
  "post-processors": [
    {
      "custom_data": {
        "build_date": "{{isotime}}",
        "build_name": "{{user `build_name`}}",
        "build_timestamp": "{{user `build_timestamp`}}",
        "containerd_version": "{{user `containerd_version`}}",
        "disk_size": "{{user `disk_size`}}",
        "distro_arch": "{{ user `distro_arch` }}",
        "distro_name": "{{ user `distro_name` }}",
        "distro_version": "{{ user `distro_version` }}",
        "firmware": "{{user `firmware`}}",
        "guest_os_type": "{{user `guest_os_type`}}",
        "ib_version": "{{user `ib_version`}}",
        "kubernetes_cni_semver": "{{user `kubernetes_cni_semver`}}",
        "kubernetes_semver": "{{user `kubernetes_semver`}}",
        "kubernetes_source_type": "{{user `kubernetes_source_type`}}",
        "kubernetes_typed_version": "{{user `kubernetes_typed_version`}}",
        "os_name": "{{user `os_display_name`}}",
        "vsphere_guest_os_type": "{{user `vsphere_guest_os_type`}}"
      },
      "except": [
        "vmware-iso-base",
        "vsphere-iso-base"
      ],
      "name": "packer-manifest",
      "output": "{{user `output_dir`}}/packer-manifest.json",
      "strip_path": true,
      "type": "manifest"
    },
    {
      "except": [
        "vsphere-iso-base"
      ],
      "inline": [
        "cd {{user `output_dir`}}",
        "../../hack/image-build-ova.py --vmx {{user `vmx_version`}} --eula ../../hack/ovf_eula.txt --ovf_template ../../hack/ovf_template.xml --vmdk_file {{user `build_version`}}-disk-0.vmdk"
      ],
      "name": "vsphere",
      "type": "shell-local"
    },
    {
      "except": [
        "vmware-iso-base"
      ],
      "inline": [
        "./hack/image-build-ova.py --stream_vmdk --vmx {{user `vmx_version`}} --eula ./hack/ovf_eula.txt --ovf_template ./hack/ovf_template.xml {{user `output_dir`}}",
        "./hack/image-post-create-config.sh {{user `output_dir`}}"
      ],
      "name": "local",
      "type": "shell-local"
    },
    {
      "environment_vars": [
        "CUSTOM_POST_PROCESSOR={{user `custom_post_processor`}}"
      ],
      "inline": [
        "if [ \"$CUSTOM_POST_PROCESSOR\" != \"true\" ]; then exit 0; fi",
        "{{user `custom_post_processor_command`}}"
      ],
      "name": "custom-post-processor",
      "type": "shell-local"
    }
  ],
  "provisioners": [
    {
      "environment_vars": [
        "BUILD_NAME={{user `build_name`}}"
      ],
      "execute_command": "BUILD_NAME={{user `build_name`}}; if [[ \"${BUILD_NAME}\" == *\"flatcar\"* ]]; then sudo {{.Vars}} -S -E bash '{{.Path}}'; fi",
      "script": "./packer/files/flatcar/scripts/bootstrap-flatcar.sh",
      "type": "shell"
    },
    {
      "ansible_env_vars": [
        "ANSIBLE_SSH_ARGS='{{user `existing_ansible_ssh_args`}} {{user `ansible_common_ssh_args`}}'"
      ],
      "except": [
        "vmware-iso-base",
        "vsphere-iso-base"
      ],
      "extra_arguments": [
        "--extra-vars",
        "{{user `ansible_common_vars`}}",
        "--extra-vars",
        "{{user `ansible_extra_vars`}}",
        "--extra-vars",
        "{{user `ansible_user_vars`}}",
        "--scp-extra-args",
        "{{user `ansible_scp_extra_args`}}"
      ],
      "playbook_file": "./ansible/firstboot.yml",
      "type": "ansible",
      "user": "{{user `ssh_username`}}"
    },
    {
      "environment_vars": [
        "DISTRO_NAME={{user `distro_name`}}"
      ],
      "expect_disconnect": true,
      "inline": [
        "if [ $DISTRO_NAME != \"photon\" ]; then exit 0; fi",
        "sudo reboot now"
      ],
      "type": "shell"
    },
    {
      "ansible_env_vars": [
        "ANSIBLE_SSH_ARGS='{{user `existing_ansible_ssh_args`}} {{user `ansible_common_ssh_args`}}'"
      ],
      "except": [
        "vmware-iso-base",
        "vsphere-iso-base"
      ],
      "extra_arguments": [
        "--extra-vars",
        "{{user `ansible_common_vars`}}",
        "--extra-vars",
        "{{user `ansible_extra_vars`}}",
        "--extra-vars",
        "{{user `ansible_user_vars`}}",
        "--scp-extra-args",
        "{{user `ansible_scp_extra_args`}}"
      ],
      "playbook_file": "./ansible/node.yml",
      "type": "ansible",
      "user": "{{user `ssh_username`}}"
    },
    {
      "arch": "{{user `goss_arch`}}",
      "download_path": "{{user `goss_download_path`}}",
      "except": [
        "vmware-iso-base",
        "vsphere-iso-base"
      ],
      "format": "{{user `goss_format`}}",
      "format_options": "{{user `goss_format_options`}}",
      "goss_file": "{{user `goss_entry_file`}}",
      "inspect": "{{user `goss_inspect_mode`}}",
      "remote_folder": "{{user `goss_remote_folder`}}",
      "remote_path": "{{user `goss_remote_path`}}",
      "skip_install": "{{user `goss_skip_install`}}",
      "tests": [
        "{{user `goss_tests_dir`}}"
      ],
      "type": "goss",
      "url": "{{user `goss_url`}}",
      "use_sudo": true,
      "vars_file": "{{user `goss_vars_file`}}",
      "vars_inline": {
        "ARCH": "amd64",
        "OS": "{{user `distro_name` | lower}}",
        "OS_VERSION": "{{user `distro_version` | lower}}",
        "PROVIDER": "ova",
        "containerd_version": "{{user `containerd_version`}}",
        "kubernetes_cni_deb_version": "{{ user `kubernetes_cni_deb_version` }}",
        "kubernetes_cni_rpm_version": "{{ split (user `kubernetes_cni_rpm_version`) \"-\" 0 }}",
        "kubernetes_cni_source_type": "{{user `kubernetes_cni_source_type`}}",
        "kubernetes_cni_version": "{{user `kubernetes_cni_semver` | replace \"v\" \"\" 1}}",
        "kubernetes_deb_version": "{{ user `kubernetes_deb_version` }}",
        "kubernetes_rpm_version": "{{ split (user `kubernetes_rpm_version`) \"-\" 0  }}",
        "kubernetes_source_type": "{{user `kubernetes_source_type`}}",
        "kubernetes_version": "{{user `kubernetes_semver` | replace \"v\" \"\" 1}}"
      },
      "version": "{{user `goss_version`}}"
    }
  ],
  "variables": {
    "ansible_common_vars": "",
    "ansible_extra_vars": "guestinfo_datasource_slug={{user `guestinfo_datasource_slug`}} guestinfo_datasource_ref={{user `guestinfo_datasource_ref`}} guestinfo_datasource_script={{user `guestinfo_datasource_script`}}",
    "ansible_scp_extra_args": "",
    "ansible_user_vars": "",
    "base_build_version": "base-{{user `build_name`}}",
    "base_output_dir": "./output/{{user `base_build_version`}}",
    "build_timestamp": "{{timestamp}}",
    "build_version": "{{user `build_name`}}-kube-{{user `kubernetes_semver`}}",
    "cluster": "",
    "containerd_sha256": null,
    "containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
    "containerd_version": null,
    "crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
    "crictl_version": null,
    "datastore": "",
    "disk_size": "20480",
    "existing_ansible_ssh_args": "{{env `ANSIBLE_SSH_ARGS`}}",
    "export_manifest": "none",
    "folder": "",
    "guest_os_type": null,
    "http_directory": "./packer/ova/linux/{{user `distro_name`}}/http/",
    "http_port_max": "",
    "http_port_min": "",
    "ib_version": "{{env `IB_VERSION`}}",
    "kubernetes_cni_deb_version": null,
    "kubernetes_cni_http_source": null,
    "kubernetes_cni_rpm_version": null,
    "kubernetes_cni_semver": null,
    "kubernetes_cni_source_type": null,
    "kubernetes_container_registry": null,
    "kubernetes_deb_gpg_key": null,
    "kubernetes_deb_repo": null,
    "kubernetes_deb_version": null,
    "kubernetes_http_source": null,
    "kubernetes_load_additional_imgs": null,
    "kubernetes_rpm_gpg_check": null,
    "kubernetes_rpm_gpg_key": null,
    "kubernetes_rpm_repo": null,
    "kubernetes_rpm_version": null,
    "kubernetes_semver": null,
    "kubernetes_source_type": null,
    "kubernetes_typed_version": "kube-{{user `kubernetes_semver`}}",
    "output_dir": "./output/{{user `build_version`}}",
    "username": "",
    "vcenter_server": "",
    "vsphere_guest_os_type": null
  }
}