diff --git a/alicloud/ubuntu_1804/README.md b/alicloud/ubuntu_1804/README.md new file mode 100644 index 0000000..e22ebc7 --- /dev/null +++ b/alicloud/ubuntu_1804/README.md @@ -0,0 +1,12 @@ +# Description + +This is for creating an Ubuntu 18.04 image for use in Alibaba Cloud. +As it stands today - 19/08/2018 - Alibaba has no official images for 18.04 so we have to make due. + +# Usage + +Just run: +``` +packer build main.json +``` +You might have to update the `source_image` if it's been a while. diff --git a/alicloud/ubuntu_1804/apt.conf b/alicloud/ubuntu_1804/apt.conf new file mode 100644 index 0000000..e57a06b --- /dev/null +++ b/alicloud/ubuntu_1804/apt.conf @@ -0,0 +1 @@ +DPkg::options { "--force-confdef"; "--force-confnew"; } diff --git a/alicloud/ubuntu_1804/main.json b/alicloud/ubuntu_1804/main.json new file mode 100644 index 0000000..0c772e1 --- /dev/null +++ b/alicloud/ubuntu_1804/main.json @@ -0,0 +1,45 @@ +{ + "variables": { + "access_key" : "{{env `ALICLOUD_ACCESS_KEY`}}", + "secret_key" : "{{env `ALICLOUD_SECRET_KEY`}}" + }, + "builders": [ + { + "type" : "alicloud-ecs", + "access_key" : "{{user `access_key`}}", + "secret_key" : "{{user `secret_key`}}", + "image_name" : "ubuntu_18_04_64_custom_20180718", + "source_image" : "ubuntu_16_0402_32_20G_alibase_20180409.vhd", + "region" : "cn-hongkong", + "ssh_username" : "root", + "instance_type" : "ecs.t5-lc2m1.nano", + "internet_charge_type" : "PayByTraffic", + "io_optimized" : "true" + } + ], + "provisioners": [ + { + "type": "file", + "source": "./apt.conf", + "destination": "/etc/apt/apt.conf" + }, + { + "type": "shell", + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive", + "DEBIAN_PRIORITY=critical" + ], + "inline": [ + "apt-get -y update", + "apt-get -o Dpkg::Options::=--force-confnew -y upgrade", + "apt-get -o Dpkg::Options::=--force-confnew -y dist-upgrade", + "apt-get -y autoremove --purge", + "apt-get -y autoclean", + "do-release-upgrade -d -f DistUpgradeViewNonInteractive", + "apt-get -y autoremove --purge", + "apt-get -y autoclean", + "echo '' > /etc/apt/apt.conf" + ] + } + ] +}