Refresh ubuntu-14.04

Closes-Bug: PROD-21397 (PROD:21397)

Change-Id: I5a7717e26c016bd5a89d9cb1031dca7c14299050
diff --git a/ubuntu-14.04/template.json b/ubuntu-14.04/template.json
index b91fa95..76d1309 100644
--- a/ubuntu-14.04/template.json
+++ b/ubuntu-14.04/template.json
@@ -1,21 +1,41 @@
 {
   "variables": {
     "user": "root",
-    "password": "ho5uo7Uome5d",
-    "do_api_token": "{{ env `DO_API_TOKEN` }}",
+    "password": "r00tme",
     "distro": "ubuntu-14-04-x64",
+    "disk_size": "8000",
+    "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
+    "ubuntu_baseurl": "https://mirror.mirantis.com/proposed/ubuntu/",
+    "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
+    "saltstack_repo": "{{ env `SALTSTACK_REPO` }}",
+    "do_api_token": "{{ env `DO_API_TOKEN` }}",
     "image_name": "{{ env `IMAGE_NAME` }}",
-    "disk_size": "8000"
+    "os_username": "{{ env `OS_USERNAME` }}",
+    "os_password": "{{ env `OS_PASSWORD` }}",
+    "os_image": "7451fac0-0ce5-4d30-ae36-cd9a90e7948e",
+    "os_endpoint": "https://cloud-cz.bud.mirantis.net:5000/v2.0",
+    "os_zone": "mcp-mk",
+    "os_floating_ip_pool": "public",
+    "os_tenant": "26e4dd19485249608ee3685f254f3909",
+    "os_network": "772f8ca6-1f4a-4535-99d0-880d6ead9a82"
   },
   "provisioners": [
     {
       "type": "shell",
-      "execute_command": "sh '{{.Path}}'",
+      "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
+      "expect_disconnect": "true",
+      "environment_vars": [
+        "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}",
+        "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
+        "SALTSTACK_REPO={{ user `saltstack_repo` }}"
+      ],
       "override": {
         "virtualbox-iso": {
           "scripts": [
             "scripts/base.sh",
+            "scripts/motd.sh",
             "scripts/salt.sh",
+            "scripts/network.sh",
             "scripts/vagrant.sh",
             "scripts/virtualbox.sh",
             "scripts/security.sh",
@@ -26,6 +46,7 @@
         "vmware-iso": {
           "scripts": [
             "scripts/base.sh",
+            "scripts/motd.sh",
             "scripts/salt.sh",
             "scripts/vmware.sh",
             "scripts/security.sh",
@@ -36,9 +57,24 @@
         "qemu": {
           "scripts": [
             "scripts/base.sh",
+            "scripts/motd.sh",
             "scripts/salt.sh",
+            "scripts/network.sh",
             "scripts/security.sh",
             "scripts/cleanup.sh",
+            "scripts/info.sh",
+            "scripts/zerodisk.sh"
+          ]
+        },
+        "openstack": {
+          "scripts": [
+            "scripts/base.sh",
+            "scripts/motd.sh",
+            "scripts/salt.sh",
+            "scripts/network.sh",
+            "scripts/security.sh",
+            "scripts/cleanup.sh",
+            "scripts/info.sh",
             "scripts/zerodisk.sh"
           ]
         },
@@ -46,6 +82,7 @@
           "scripts": [
             "scripts/docker.sh",
             "scripts/base.sh",
+            "scripts/motd.sh",
             "scripts/salt.sh",
             "scripts/cleanup.sh"
           ]
@@ -53,6 +90,7 @@
         "digitalocean": {
           "scripts": [
             "scripts/base.sh",
+            "scripts/motd.sh",
             "scripts/salt.sh",
             "scripts/security.sh",
             "scripts/cleanup.sh"
@@ -62,12 +100,12 @@
     },
     {
       "type": "file",
-      "source": "configs/cloud/cloud.cfg.d/99_tcp.cfg",
+      "source": "files/etc/cloud/cloud.cfg.d/99_tcp.cfg",
       "destination": "/etc/cloud/cloud.cfg.d/99_tcp.cfg"
     },
     {
       "type": "file",
-      "source": "configs/cloud/cloud.cfg",
+      "source": "files/etc/cloud/cloud.cfg",
       "destination": "/etc/cloud/cloud.cfg"
     }
   ],
@@ -131,14 +169,14 @@
       "output_directory": "images/{{ user `distro` }}-vbox-{{ isotime \"200601021504\"  }}",
       "guest_os_type": "Ubuntu_64",
       "http_directory": "http",
-      "iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
+      "iso_checksum": "10fcd20619dce11fe094e960c85ba4a9",
       "iso_checksum_type": "md5",
-      "iso_url": "http://releases.ubuntu.mirror.dkm.cz/releases/14.04/ubuntu-14.04.5-server-amd64.iso",
+      "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso",
       "ssh_username": "{{user `user`}}",
       "ssh_password": "{{user `password`}}",
       "ssh_port": 22,
       "ssh_wait_timeout": "10000s",
-      "shutdown_command": "shutdown -P now",
+      "shutdown_command": "pgrep -f 'sshd: root@' | xargs kill -9 ; shutdown -P now",
       "headless": true,
       "vboxmanage": [
         [
@@ -208,14 +246,14 @@
       "output_directory": "images/{{ user `distro` }}-vmware-{{ isotime \"200601021504\"  }}",
       "guest_os_type": "linux",
       "http_directory": "http",
-      "iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
+      "iso_checksum": "10fcd20619dce11fe094e960c85ba4a9",
       "iso_checksum_type": "md5",
-      "iso_url": "http://releases.ubuntu.mirror.dkm.cz/releases/14.04/ubuntu-14.04.5-server-amd64.iso",
+      "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso",
       "ssh_username": "{{user `user`}}",
       "ssh_password": "{{user `password`}}",
       "ssh_port": 22,
       "ssh_wait_timeout": "10000s",
-      "shutdown_command": "shutdown -P now",
+      "shutdown_command": "pgrep -f 'sshd: root@' | xargs kill -9 ; shutdown -P now",
       "vmx_data": {
         "memsize": "1024",
         "numvcpus": "1",
@@ -223,56 +261,6 @@
       }
     },
     {
-      "type": "qemu",
-      "qemuargs": [
-        [
-          "-m",
-          "1024M"
-        ]
-      ],
-      "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\"  }}",
-      "output_directory": "images/{{ user `distro` }}-qemu-{{ isotime \"200601021504\"  }}",
-      "format": "qcow2",
-      "accelerator": "kvm",
-      "disk_size": "{{ user `disk_size`}}",
-      "iso_url": "http://releases.ubuntu.mirror.dkm.cz/releases/14.04/ubuntu-14.04.5-server-amd64.iso",
-      "iso_checksum_type": "md5",
-      "iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
-      "http_directory": "http",
-      "headless": true,
-      "ssh_username": "{{user `user`}}",
-      "ssh_password": "{{user `password`}}",
-      "shutdown_command": "shutdown -P now",
-      "boot_wait": "2s",
-      "ssh_wait_timeout": "10000s",
-      "boot_command": [
-        "<esc><wait>",
-        "<esc><wait>",
-        "<enter><wait>",
-        "/install/vmlinuz<wait>",
-        " auto<wait>",
-        " console-setup/ask_detect=false<wait>",
-        " console-setup/layoutcode=us<wait>",
-        " console-setup/modelcode=pc105<wait>",
-        " debconf/frontend=noninteractive<wait>",
-        " debian-installer=en_US<wait>",
-        " fb=false<wait>",
-        " initrd=/install/initrd.gz<wait>",
-        " kbd-chooser/method=us<wait>",
-        " keyboard-configuration/layout=USA<wait>",
-        " keyboard-configuration/variant=USA<wait>",
-        " passwd/root-password={{user `password`}} ",
-        " passwd/root-password-again={{user `password`}} ",
-        " locale=en_US<wait>",
-        " netcfg/get_hostname=ubuntu-1404<wait>",
-        " netcfg/get_domain=changeme<wait>",
-        " noapic<wait>",
-        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
-        " -- <wait>",
-        "<enter><wait>"
-      ]
-    },
-    {
       "type": "docker",
       "image": "ubuntu:14.04",
       "commit": true
@@ -284,6 +272,49 @@
       "snapshot_name": "{{ user `image_name` }}-{{ isotime \"200601021504\"  }}",
       "region": "ams2",
       "size": "1gb"
+    },
+    {
+      "type": "qemu",
+      "qemuargs": [
+        [ "-m", "1024M" ],
+        [ "-cdrom", "config-drive/cloudata.iso" ]
+      ],
+      "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\"  }}",
+      "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\"  }}",
+      "format": "qcow2",
+      "iso_checksum": "06d561ab1ae8723493b484c1effc2790",
+      "iso_checksum_type": "md5",
+      "iso_url": "http://cloud-images.ubuntu.com/releases/trusty/release-20180703/ubuntu-14.04-server-cloudimg-amd64-disk1.img",
+      "iso_target_path": "{{ user `images_cache`}}/release-20180703_ubuntu-14.04-server-cloudimg-amd64-disk1.img",
+      "disk_image": true,
+      "disk_compression": true,
+      "accelerator": "kvm",
+      "disk_size": "{{ user `disk_size`}}",
+      "headless": true,
+      "ssh_username": "{{ user `user` }}",
+      "ssh_password": "{{ user `password` }}",
+      "ssh_host_port_min": 7000,
+      "ssh_host_port_max": 7050,
+      "shutdown_command": "pgrep -f 'sshd: root@' | xargs kill -9 ; shutdown -P now",
+      "boot_wait": "2s",
+      "ssh_wait_timeout": "360s"
+    },
+    {
+      "type": "openstack",
+      "ssh_username": "{{ user `user` }}",
+      "ssh_password": "{{ user `password` }}",
+      "image_name": "{{user `image_name`}}",
+      "floating_ip_pool": "{{user `os_floating_ip_pool`}}",
+      "reuse_ips": "true",
+      "source_image": "{{ user `os_image` }}",
+      "flavor": "{{ user `os_flavor` }}",
+      "user_data_file": "config-drive/user-data.yaml",
+      "tenant_id": "{{ user `os_tenant` }}",
+      "networks": ["{{ user `os_network` }}"],
+      "availability_zone": "{{user `os_zone`}}",
+      "identity_endpoint": "{{user `os_endpoint`}}",
+      "username": "{{user `os_username`}}",
+      "password": "{{user `os_password`}}"
     }
   ]
-}
\ No newline at end of file
+}