{
  "builders": [
    {
      "azure_tags": {
        "build_date": "{{isotime}}",
        "build_timestamp": "{{user `build_timestamp`}}",
        "creationTimestamp": "{{isotime \"2006-01-02T15:04:05Z\"}}",
        "distribution": "{{user `distribution`}}",
        "distribution_release": "{{user `distribution_release`}}",
        "distribution_version": "{{user `distribution_version`}}",
        "image_builder_version": "{{user `ib_version`}}",
        "kubernetes_version": "{{user `kubernetes_semver`}}"
      },
      "capture_container_name": "{{user `capture_container_name`}}",
      "capture_name_prefix": "capi-{{user `build_timestamp`}}",
      "client_id": "{{user `client_id`}}",
      "client_secret": "{{user `client_secret`}}",
      "image_offer": "{{user `image_offer` }}",
      "image_publisher": "{{user `image_publisher` }}",
      "image_sku": "{{user `image_sku`}}",
      "image_version": "{{user `image_version`}}",
      "location": "{{user `azure_location`}}",
      "name": "vhd-{{user `build_name`}}",
      "os_disk_size_gb": "{{user `os_disk_size_gb`}}",
      "os_type": "Linux",
      "private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}",
      "resource_group_name": "{{user `resource_group_name`}}",
      "ssh_username": "packer",
      "storage_account": "{{user `storage_account_name`}}",
      "subscription_id": "{{user `subscription_id`}}",
      "type": "azure-arm",
      "virtual_network_name": "{{user `virtual_network_name`}}",
      "virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}",
      "virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}",
      "vm_size": "{{user `vm_size`}}"
    },
    {
      "azure_tags": {
        "build_date": "{{isotime}}",
        "build_timestamp": "{{user `build_timestamp`}}",
        "creationTimestamp": "{{isotime \"2006-01-02T15:04:05Z\"}}",
        "distribution": "{{user `distribution`}}",
        "distribution_release": "{{user `distribution_release`}}",
        "distribution_version": "{{user `distribution_version`}}",
        "image_builder_version": "{{user `ib_version`}}",
        "kubernetes_version": "{{user `kubernetes_semver`}}"
      },
      "client_id": "{{user `client_id`}}",
      "client_secret": "{{user `client_secret`}}",
      "image_offer": "{{user `image_offer` }}",
      "image_publisher": "{{user `image_publisher` }}",
      "image_sku": "{{user `image_sku`}}",
      "image_version": "{{user `image_version`}}",
      "location": "{{user `azure_location`}}",
      "managed_image_name": "{{user `image_name`}}-{{user `build_timestamp`}}",
      "managed_image_resource_group_name": "{{user `resource_group_name`}}",
      "managed_image_storage_account_type": "{{user `storage_account_type`}}",
      "name": "sig-{{user `build_name`}}",
      "os_disk_size_gb": "{{user `os_disk_size_gb`}}",
      "os_type": "Linux",
      "plan_info": {
        "plan_name": "{{user `plan_image_sku`}}",
        "plan_product": "{{user `plan_image_offer`}}",
        "plan_publisher": "{{user `plan_image_publisher`}}"
      },
      "private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}",
      "shared_gallery_image_version_exclude_from_latest": "{{ user `exclude_from_latest` }}",
      "shared_image_gallery": {
        "community_gallery_image_id": "{{ user `community_gallery_image_id` }}",
        "direct_shared_gallery_image_id": "{{ user `direct_shared_gallery_image_id` }}",
        "gallery_name": "{{user `source_sig_name`}}",
        "image_name": "{{user `source_sig_image_name`}}",
        "image_version": "{{user `source_sig_image_version`}}",
        "resource_group": "{{user `source_sig_resource_group_name`}}",
        "subscription": "{{user `source_sig_subscription_id`}}"
      },
      "shared_image_gallery_destination": {
        "gallery_name": "{{user `shared_image_gallery_name`}}",
        "image_name": "{{user `image_name`}}",
        "image_version": "{{user `sig_image_version`}}",
        "replication_regions": "{{user `replication_regions`}}",
        "resource_group": "{{user `resource_group_name`}}",
        "storage_account_type": "{{user `storage_account_type`}}"
      },
      "ssh_username": "packer",
      "subscription_id": "{{user `subscription_id`}}",
      "type": "azure-arm",
      "virtual_network_name": "{{user `virtual_network_name`}}",
      "virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}",
      "virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}",
      "vm_size": "{{user `vm_size`}}"
    }
  ],
  "post-processors": [
    {
      "custom_data": {
        "build_date": "{{isotime}}",
        "build_name": "{{user `build_name`}}",
        "build_timestamp": "{{user `build_timestamp`}}",
        "build_type": "node",
        "containerd_version": "{{user `containerd_version`}}",
        "kubernetes_cni_semver": "{{user `kubernetes_cni_semver`}}",
        "kubernetes_semver": "{{user `kubernetes_semver`}}",
        "kubernetes_source_type": "{{user `kubernetes_source_type`}}",
        "os_name": "{{user `distro_name`}}",
        "resource_group_name": "{{user `resource_group_name`}}",
        "storage_account_name": "{{user `storage_account_name`}}"
      },
      "output": "{{user `manifest_output`}}",
      "strip_path": true,
      "type": "manifest"
    }
  ],
  "provisioners": [
    {
      "environment_vars": [
        "BUILD_NAME={{user `build_name`}}"
      ],
      "inline": [
        "if [ $BUILD_NAME != \"ubuntu-1804\" ] && [ $BUILD_NAME != \"ubuntu-1804-gen2\" ]; then exit 0; fi",
        "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done",
        "sudo apt-get -qq update && sudo DEBIAN_FRONTEND=noninteractive apt-get -qqy install python python-pip"
      ],
      "type": "shell"
    },
    {
      "ansible_env_vars": [
        "ANSIBLE_SSH_ARGS='{{user `existing_ansible_ssh_args`}} {{user `ansible_common_ssh_args`}}'"
      ],
      "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/python.yml",
      "type": "ansible",
      "user": "packer"
    },
    {
      "ansible_env_vars": [
        "ANSIBLE_SSH_ARGS='{{user `existing_ansible_ssh_args`}} {{user `ansible_common_ssh_args`}}'"
      ],
      "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": "packer"
    },
    {
      "arch": "{{user `goss_arch`}}",
      "download_path": "{{user `goss_download_path`}}",
      "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 `distribution` | lower}}",
        "OS_VERSION": "{{user `distribution_version` | lower}}",
        "PROVIDER": "azure",
        "containerd_version": "{{user `containerd_version`}}",
        "containerd_wasm_shims_runtimes": "{{user `containerd_wasm_shims_runtimes` }}",
        "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`}}"
    },
    {
      "environment_vars": [
        "BUILD_NAME={{user `build_name`}}"
      ],
      "inline": [
        "if [[ $BUILD_NAME != \"flatcar\"* ]]; then exit 0; fi",
        "sudo bash -c \"/usr/share/oem/python/bin/python /usr/share/oem/bin/waagent -force -deprovision+user && sync\""
      ],
      "inline_shebang": "/bin/bash -x",
      "remote_folder": "{{user `provisioner_remote_folder`}}",
      "type": "shell"
    }
  ],
  "variables": {
    "ansible_common_vars": "",
    "ansible_extra_vars": "",
    "ansible_scp_extra_args": "",
    "ansible_user_vars": "",
    "azure_location": null,
    "build_name": null,
    "build_resource_group_name": "{{ env `BUILD_RESOURCE_GROUP_NAME` }}",
    "build_timestamp": "{{timestamp}}",
    "client_id": null,
    "client_secret": null,
    "community_gallery_image_id": "",
    "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,
    "containerd_wasm_shims_runtimes": 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,
    "direct_shared_gallery_image_id": "",
    "distribution": null,
    "distribution_release": null,
    "distribution_version": null,
    "exclude_from_latest": "false",
    "existing_ansible_ssh_args": "{{env `ANSIBLE_SSH_ARGS`}}",
    "ib_version": "{{env `IB_VERSION`}}",
    "image_offer": "",
    "image_publisher": "",
    "image_sku": "",
    "image_version": "latest",
    "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_series": null,
    "kubernetes_source_type": null,
    "manifest_output": "manifest.json",
    "os_disk_size_gb": "",
    "plan_image_offer": "",
    "plan_image_publisher": "",
    "plan_image_sku": "",
    "private_virtual_network_with_public_ip": "",
    "provisioner_remote_folder": "/tmp",
    "source_sig_image_name": "",
    "source_sig_image_version": "",
    "source_sig_name": "",
    "source_sig_resource_group_name": "",
    "source_sig_subscription_id": "",
    "storage_account_type": "",
    "subscription_id": null,
    "virtual_network_name": "",
    "virtual_network_resource_group_name": "",
    "virtual_network_subnet_name": "",
    "vm_size": ""
  }
}