ubuntu1804.json
{ "variables": { "install_user": "appveyor", "install_password": "appveyor", "install_home":"/home/appveyor", "APPVEYOR_BUILD_AGENT_VERSION": "{{env `APPVEYOR_BUILD_AGENT_VERSION`}}", "host_ip_addr": "10.0.0.47", "host_ip_mask": "255.255.255.0", "host_ip_gw": "10.0.0.1", "aws_access_key": "", "aws_secret_key": "", "aws_region": "", "aws_ssh_keypair_name": "", "aws_ssh_private_key_file": "", "gce_account_file": "", "gce_zone": "", "gce_project": "", "gce_source_image": "ubuntu-1804-bionic-v20190212a", "gce_source_image_family": "ubuntu-1804-lts", "iso_checksum_md5": "cb7cd5a0c94899a04a536441c8b6d2bf", "azure_client_id": "", "azure_client_secret": "", "azure_location": "", "azure_resource_group_name": "", "azure_storage_account": "", "azure_subscription_id": "", "azure_vm_size": "Standard_A2_v2", "image_description": "", "deploy_parts": "", "datemark": "" }, "provisioners": [ { "type": "file", "source": "distrib", "destination": "./", "generated": "true" }, { "type": "file", "source": "{{ template_dir }}/scripts/Ubuntu/custom-scripts", "destination": "./custom-scripts" }, { "type": "file", "source": "scripts/Ubuntu/", "destination": "./" }, { "type": "shell", "environment_vars": [ "USER_NAME={{ user `install_user` }}", "USER_PASSWORD={{ user `install_password` }}", "USER_HOME={{ user `install_home` }}", "APPVEYOR_BUILD_AGENT_VERSION={{user `APPVEYOR_BUILD_AGENT_VERSION` }}", "DATEMARK={{ user `datemark` }}", "OPT_FEATURES={{ user `opt_features` }}" ], "execute_command": "echo '{{ user `install_password` }}' | {{.Vars}} sudo -S -E bash -eu '{{.Path}}' {{user `deploy_parts`}}", "scripts": [ "scripts/Ubuntu/basicconfig.sh" ] }, { "type": "shell", "scripts":[ "{{ template_dir }}/scripts/Ubuntu/run_custom_scripts.sh" ] }, { "type": "file", "direction": "download", "source": "versions-{{ user `datemark` }}.log", "destination": "./" }, { "type": "file", "direction": "download", "source": "pwd-{{ user `datemark` }}.log", "destination": "./" }, { "type": "shell", "inline": [ "if [ -f pwd-{{ user `datemark` }}.log ]; then rm pwd-{{ user `datemark` }}.log; fi", "if [ -f .ssh/authorized_keys ]; then rm .ssh/authorized_keys; fi", "find . -maxdepth 1 -name 'script_*.sh-*.log' -delete" ] } ], "builders": [ { "type": "googlecompute", "account_file": "{{user `gce_account_file`}}", "project_id": "{{ user `gce_project` }}", "zone": "{{ user `gce_zone` }}", "source_image": "{{ user `gce_source_image` }}", "state_timeout" : "15m", "scopes": [ "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring.write", "https://www.googleapis.com/auth/servicecontrol", "https://www.googleapis.com/auth/service.management.readonly", "https://www.googleapis.com/auth/trace.append" ], "machine_type": "n1-standard-1", "ssh_username": "{{ user `install_user` }}", "instance_name": "packer-ubuntu1804-{{uuid}}", "image_name": "packer-ubuntu1804-{{timestamp}}", "image_description": "{{ user `image_description` }}", "disk_size": 40, "image_licenses": ["projects/vm-options/global/licenses/enable-vmx"] }, { "type": "hyperv-iso", "boot_command": [ "<esc><wait10><esc><esc><enter><wait>", "linux /install/vmlinuz ", " netcfg/disable_autoconfig=true<wait>", " netcfg/get_ipaddress={{ user `host_ip_addr` }}<wait>", " netcfg/get_netmask={{ user `host_ip_mask` }}<wait>", " netcfg/get_gateway={{ user `host_ip_gw` }}<wait>", " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed18.cfg<wait>", " netcfg/get_nameservers=8.8.8.8", " debian-installer=en_US.UTF-8 auto locale=en_US.UTF-8 kbd-chooser/method=us", " hostname={{.Name}} domain= ", " fb=false debconf/frontend=noninteractive", " keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA", " keyboard-configuration/variant=USA console-setup/ask_detect=false<enter>", "initrd /install/initrd.gz<enter>", "boot<enter>" ], "boot_wait": "10s", "http_directory": "http", "iso_urls": [ "iso/ubuntu-18.04.3-server-amd64.iso", "http://cdimage.ubuntu.com/releases/bionic/release/ubuntu-18.04.3-server-amd64.iso" ], "iso_checksum": "{{user `iso_checksum_md5`}}", "iso_checksum_type": "md5", "ssh_host": "{{ user `host_ip_addr` }}", "ssh_username": "{{ user `install_user` }}", "ssh_password": "{{ user `install_password` }}", "ssh_timeout" : "1h", "shutdown_command": "echo '{{ user `install_password` }}' | sudo -S shutdown -P now", "cpus": "1", "memory": "3072", "disk_size": 40960, "disk_block_size": "1", "enable_secure_boot": false, "generation": 2 }, { "type": "hyperv-vmcx", "clone_from_vm_name": "u18-empty", "vm_name": "packer-u18-{{ user `datemark` }}", "ssh_username": "{{ user `install_user` }}", "ssh_password": "{{ user `install_password` }}", "shutdown_command": "echo '{{ user `install_password` }}' | sudo -S shutdown -P now", "http_directory": "http", "communicator":"ssh", "ssh_timeout" : "1h", "ssh_port": 22, "ssh_host": "{{user `host_ip_addr`}}", "cpu": "1", "ram_size": "3072", "enable_secure_boot": "false" }, { "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region": "{{user `aws_region`}}", "source_ami_filter": { "filters": { "virtualization-type": "hvm", "name": "ubuntu/images/*ubuntu-bionic-18.04-amd64-server-*", "root-device-type": "ebs" }, "owners": ["099720109477"], "most_recent": true }, "instance_type": "m4.large", "ssh_username": "ubuntu", "ssh_keypair_name": "{{user `aws_ssh_keypair_name`}}", "ssh_private_key_file": "{{user `aws_ssh_private_key_file`}}", "ssh_timeout": "1000s", "ami_name": "Appveyor Worker Ubuntu1804 {{timestamp}}", "ami_description": "{{user `image_description`}}", "launch_block_device_mappings": [ { "device_name": "/dev/sda1", "volume_size": 40, "volume_type": "gp2", "delete_on_termination": true } ], "run_tags": { "OS_Version": "Ubuntu1804", "datemark": "{{user `datemark`}}", "description": "{{user `image_description`}}", "Base_AMI_Name": "{{ .SourceAMIName }}", "Extra": "{{ .SourceAMITags.TagName }}" }, "tags": { "OS_Version": "Ubuntu1804", "datemark": "{{user `datemark`}}", "description": "{{user `image_description`}}", "Base_AMI_Name": "{{ .SourceAMIName }}", "Extra": "{{ .SourceAMITags.TagName }}" } }, { "type": "virtualbox-iso", "boot_command": [ "<esc><wait>", "<esc><wait>", "<enter><wait>", "/install/vmlinuz<wait>", " initrd=/install/initrd.gz<wait>", " auto-install/enable=true<wait>", " debconf/priority=critical<wait>", " noapic<wait>", " netcfg/disable_autoconfig=true<wait>", " netcfg/get_ipaddress={{user `host_ip_addr`}}<wait>", " netcfg/get_netmask={{user `host_ip_mask`}}<wait>", " netcfg/get_gateway={{user `host_ip_gw`}}<wait>", " preseed/url=http://192.168.0.1:{{ .HTTPPort }}/preseed18.cfg<wait>", " netcfg/get_nameservers=8.8.8.8", " -- <wait>", "<enter><wait>" ], "boot_wait": "10s", "disk_size": 40960, "guest_os_type": "Ubuntu_64", "headless": true, "http_directory": "http", "iso_urls": [ "iso/ubuntu-18.04.3-server-amd64.iso", "http://cdimage.ubuntu.com/releases/bionic/release/ubuntu-18.04.3-server-amd64.iso" ], "iso_checksum": "{{user `iso_checksum_md5`}}", "iso_checksum_type": "md5", "ssh_username": "{{ user `install_user` }}", "ssh_password": "{{ user `install_password` }}", "ssh_port": 22, "ssh_wait_timeout": "10000s", "ssh_host": "{{user `host_ip_addr`}}", "ssh_skip_nat_mapping": "true", "shutdown_command": "echo 'appveyor'|sudo -S shutdown -P now", "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", "virtualbox_version_file": ".vbox_version", "vm_name": "packer-ubuntu-18.04", "vboxmanage": [ [ "modifyvm", "{{.Name}}", "--memory", "3072" ], [ "modifyvm", "{{.Name}}", "--cpus", "1" ], [ "modifyvm", "{{.Name}}", "--nic1", "hostonly" ], [ "modifyvm", "{{.Name}}", "--hostonlyadapter1", "vboxnet0" ], [ "modifyvm", "{{.Name}}", "--nicpromisc1", "allow-all" ], [ "modifyvm", "{{.Name}}", "--cableconnected1", "on" ] ] }, { "type": "virtualbox-ovf", "source_path": "ovf/packer-ubuntu-18.04.ovf", "boot_wait": "10s", "headless": true, "http_directory": "http", "ssh_username": "{{ user `install_user` }}", "ssh_password": "{{ user `install_password` }}", "ssh_port": 22, "ssh_wait_timeout": "10000s", "ssh_host": "{{user `host_ip_addr`}}", "ssh_skip_nat_mapping": "true", "shutdown_command": "echo '{{user `install_password`}}'|sudo -S shutdown -P now", "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", "virtualbox_version_file": ".vbox_version", "vm_name": "packer-ubuntu-18.04", "vboxmanage": [ [ "modifyvm", "{{.Name}}", "--memory", "3072" ], [ "modifyvm", "{{.Name}}", "--cpus", "1" ], [ "modifyvm", "{{.Name}}", "--nic1", "hostonly" ], [ "modifyvm", "{{.Name}}", "--hostonlyadapter1", "vboxnet0" ], [ "modifyvm", "{{.Name}}", "--nicpromisc1", "allow-all" ], [ "modifyvm", "{{.Name}}", "--cableconnected1", "on" ] ] }, { "type": "azure-arm", "subscription_id": "{{ user `azure_subscription_id` }}", "client_id": "{{ user `azure_client_id` }}", "client_secret": "{{ user `azure_client_secret` }}", "location": "{{ user `azure_location` }}", "temp_resource_group_name": "packer-RG-u18-{{uuid}}", "temp_compute_name": "packer-u18-{{uuid}}", "os_type": "Linux", "image_publisher": "Canonical", "image_offer": "UbuntuServer", "image_sku": "18.04-LTS", "vm_size": "{{user `azure_vm_size`}}", "capture_container_name": "appveyor-images-u18", "capture_name_prefix": "u18-{{user `datemark`}}", "resource_group_name": "{{ user `azure_resource_group_name` }}", "storage_account": "{{ user `azure_storage_account` }}", "communicator": "ssh", "azure_tags": { "automation": "packer", "OS": "ubuntu1804", "description": "{{user `image_description`}}", "date": "{{user `datemark`}}" } } ], "post-processors": [ { "type": "manifest", "output": "{{user `packer_manifest`}}", "strip_path": true } ] } |