Chore: Update common-packer to the latest v0.14.1 27/135327/2
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 5 Jul 2023 11:49:06 +0000 (21:49 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 12 Jul 2023 02:14:23 +0000 (12:14 +1000)
Create local templates in hcl2 format to work with packer updates.

Issue-ID: CIMAN-33
Change-Id: Ia5700bae9712df4d33ab83ca410d692692ad0c99
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
packer/common-packer
packer/provision/devstack-centos.yaml
packer/provision/devstack.yaml [new symlink]
packer/templates/builder-aws.pkr.hcl [new symlink]
packer/templates/builder.pkr.hcl [new symlink]
packer/templates/devstack-pre-pip-yoga.pkr.hcl [new symlink]
packer/templates/devstack.pkr.hcl [new symlink]
packer/templates/docker.pkr.hcl [new symlink]
packer/templates/helm.pkr.hcl [new file with mode: 0644]
packer/templates/memcached.pkr.hcl [new file with mode: 0644]
packer/templates/redis.pkr.hcl [new file with mode: 0644]

index 17bfe57..09cb3bc 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 17bfe57174ebf0e699cfcc235e83d6d568695651
+Subproject commit 09cb3bcf48185afdc5af0a548be904491ae215de
index dc02778..7f43aab 120000 (symlink)
@@ -1 +1 @@
-../common-packer/provision/devstack-centos.yaml
\ No newline at end of file
+../common-packer/provision/devstack.yaml
\ No newline at end of file
diff --git a/packer/provision/devstack.yaml b/packer/provision/devstack.yaml
new file mode 120000 (symlink)
index 0000000..7f43aab
--- /dev/null
@@ -0,0 +1 @@
+../common-packer/provision/devstack.yaml
\ No newline at end of file
diff --git a/packer/templates/builder-aws.pkr.hcl b/packer/templates/builder-aws.pkr.hcl
new file mode 120000 (symlink)
index 0000000..d82c073
--- /dev/null
@@ -0,0 +1 @@
+../common-packer/templates/builder-aws.pkr.hcl
\ No newline at end of file
diff --git a/packer/templates/builder.pkr.hcl b/packer/templates/builder.pkr.hcl
new file mode 120000 (symlink)
index 0000000..8ea2d87
--- /dev/null
@@ -0,0 +1 @@
+../common-packer/templates/builder.pkr.hcl
\ No newline at end of file
diff --git a/packer/templates/devstack-pre-pip-yoga.pkr.hcl b/packer/templates/devstack-pre-pip-yoga.pkr.hcl
new file mode 120000 (symlink)
index 0000000..9be8ba8
--- /dev/null
@@ -0,0 +1 @@
+../common-packer/templates/devstack-pre-pip-yoga.pkr.hcl
\ No newline at end of file
diff --git a/packer/templates/devstack.pkr.hcl b/packer/templates/devstack.pkr.hcl
new file mode 120000 (symlink)
index 0000000..25b407e
--- /dev/null
@@ -0,0 +1 @@
+../common-packer/templates/devstack.pkr.hcl
\ No newline at end of file
diff --git a/packer/templates/docker.pkr.hcl b/packer/templates/docker.pkr.hcl
new file mode 120000 (symlink)
index 0000000..08567df
--- /dev/null
@@ -0,0 +1 @@
+../common-packer/templates/docker.pkr.hcl
\ No newline at end of file
diff --git a/packer/templates/helm.pkr.hcl b/packer/templates/helm.pkr.hcl
new file mode 100644 (file)
index 0000000..8468fcb
--- /dev/null
@@ -0,0 +1,169 @@
+packer {
+  required_plugins {
+    openstack = {
+      version = ">= 1.0.0"
+      source  = "github.com/hashicorp/openstack"
+    }
+  }
+}
+
+variable "cloud_auth_url" {
+  type    = string
+  default = null
+}
+
+variable "cloud_tenant" {
+  type    = string
+  default = null
+}
+
+variable "cloud_user" {
+  type    = string
+  default = null
+}
+
+variable "cloud_pass" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_name" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_product_code" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_owner" {
+  type    = string
+  default = null
+}
+
+variable "ansible_roles_path" {
+  type    = string
+  default = ".galaxy"
+}
+
+variable "arch" {
+  type    = string
+  default = "x86_64"
+}
+
+variable "base_image" {
+  type = string
+  default = null
+}
+
+variable "cloud_network" {
+  type = string
+  default = null
+}
+
+variable "cloud_region" {
+  type    = string
+  default = "ca-ymq-1"
+}
+
+variable "cloud_user_data" {
+  type = string
+  default = null
+}
+
+variable "distro" {
+  type = string
+  default = null
+}
+
+variable "docker_source_image" {
+  type = string
+  default = null
+}
+
+variable "flavor" {
+  type    = string
+  default = "v2-highcpu-1"
+}
+
+variable "ssh_proxy_host" {
+  type    = string
+  default = ""
+}
+
+variable "ssh_user" {
+  type = string
+  default = null
+}
+
+variable "vm_image_disk_format" {
+  type    = string
+  default = ""
+}
+
+variable "vm_use_block_storage" {
+  type    = string
+  default = "true"
+}
+
+variable "vm_volume_size" {
+  type    = string
+  default = "20"
+}
+
+source "docker" "helm" {
+  changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"]
+  commit  = true
+  image   = "${var.docker_source_image}"
+}
+
+source "openstack" "helm" {
+  domain_name       = "Default"
+  flavor            = "${var.flavor}"
+  identity_endpoint = "${var.cloud_auth_url}"
+  image_name        = "ZZCI - ${var.distro} - helm - ${var.arch} - ${legacy_isotime("20060102-150405.000")}"
+  instance_name     = "${var.distro}-builder-${uuidv4()}"
+  metadata = {
+    ci_managed = "yes"
+  }
+  networks          = ["${var.cloud_network}"]
+  password          = "${var.cloud_pass}"
+  region            = "ca-ymq-1"
+  source_image_name = "${var.base_image}"
+  ssh_proxy_host    = "${var.ssh_proxy_host}"
+  ssh_username      = "${var.ssh_user}"
+  tenant_name       = "${var.cloud_tenant}"
+  user_data_file    = "${var.cloud_user_data}"
+  username          = "${var.cloud_user}"
+}
+
+build {
+  sources = ["source.docker.helm", "source.openstack.helm"]
+
+  provisioner "shell" {
+    execute_command = "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
+    scripts         = ["common-packer/provision/install-python.sh"]
+  }
+
+  provisioner "shell-local" {
+    command = "./common-packer/ansible-galaxy.sh ${var.ansible_roles_path}"
+  }
+
+  provisioner "ansible" {
+    ansible_env_vars   = [
+      "ANSIBLE_NOCOWS=1",
+      "ANSIBLE_PIPELINING=True",
+      "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+      "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+      "ANSIBLE_STDOUT_CALLBACK=debug"
+    ]
+    command            = "./common-packer/ansible-playbook.sh"
+    extra_arguments    = [
+      "--scp-extra-args", "'-O'",
+      "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"
+    ]
+    playbook_file      = "provision/helm.yaml"
+    skip_version_check = true
+  }
+}
diff --git a/packer/templates/memcached.pkr.hcl b/packer/templates/memcached.pkr.hcl
new file mode 100644 (file)
index 0000000..cd1a610
--- /dev/null
@@ -0,0 +1,168 @@
+packer {
+  required_plugins {
+    openstack = {
+      version = ">= 1.0.0"
+      source  = "github.com/hashicorp/openstack"
+    }
+  }
+}
+
+variable "cloud_auth_url" {
+  type    = string
+  default = null
+}
+
+variable "cloud_tenant" {
+  type    = string
+  default = null
+}
+
+variable "cloud_user" {
+  type    = string
+  default = null
+}
+
+variable "cloud_pass" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_name" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_product_code" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_owner" {
+  type    = string
+  default = null
+}
+
+variable "ansible_roles_path" {
+  type    = string
+  default = ".galaxy"
+}
+
+variable "arch" {
+  type    = string
+  default = "x86_64"
+}
+
+variable "base_image" {
+  type = string
+  default = null
+}
+
+variable "cloud_network" {
+  type = string
+  default = null
+}
+
+variable "cloud_region" {
+  type    = string
+  default = "ca-ymq-1"
+}
+
+variable "cloud_user_data" {
+  type = string
+  default = null
+}
+
+variable "distro" {
+  type = string
+  default = null
+}
+
+variable "docker_source_image" {
+  type = string
+  default = null
+}
+
+variable "flavor" {
+  type    = string
+  default = "v2-highcpu-1"
+}
+
+variable "ssh_proxy_host" {
+  type    = string
+  default = ""
+}
+
+variable "ssh_user" {
+  type = string
+  default = null
+}
+
+variable "vm_image_disk_format" {
+  type    = string
+  default = ""
+}
+
+variable "vm_use_block_storage" {
+  type    = string
+  default = "true"
+}
+
+variable "vm_volume_size" {
+  type    = string
+  default = "20"
+}
+
+source "docker" "memcached" {
+  changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"]
+  commit  = true
+  image   = "${var.docker_source_image}"
+}
+
+source "openstack" "memcached" {
+  domain_name       = "Default"
+  flavor            = "${var.flavor}"
+  identity_endpoint = "${var.cloud_auth_url}"
+  image_name        = "${var.distro} - memcached - ${var.arch} - ${legacy_isotime("20180101-1003")}"
+  metadata = {
+    ci_managed = "yes"
+  }
+  networks          = ["${var.cloud_network}"]
+  password          = "${var.cloud_pass}"
+  region            = "ca-ymq-1"
+  source_image_name = "${var.base_image}"
+  ssh_proxy_host    = "${var.ssh_proxy_host}"
+  ssh_username      = "${var.ssh_user}"
+  tenant_name       = "${var.cloud_tenant}"
+  user_data_file    = "${var.cloud_user_data}"
+  username          = "${var.cloud_user}"
+}
+
+build {
+  sources = ["source.docker.memcached", "source.openstack.memcached"]
+
+  provisioner "shell" {
+    execute_command = "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
+    scripts         = ["common-packer/provision/install-python.sh"]
+  }
+
+  provisioner "shell-local" {
+    command = "./common-packer/ansible-galaxy.sh ${var.ansible_roles_path}"
+  }
+
+  provisioner "ansible" {
+    ansible_env_vars   = [
+      "ANSIBLE_NOCOWS=1",
+      "ANSIBLE_PIPELINING=True",
+      "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+      "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+      "ANSIBLE_STDOUT_CALLBACK=debug"
+    ]
+    command            = "./common-packer/ansible-playbook.sh"
+    extra_arguments    = [
+      "--scp-extra-args", "'-O'",
+      "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"
+    ]
+    playbook_file      = "provision/memcached.yaml"
+    skip_version_check = true
+  }
+}
diff --git a/packer/templates/redis.pkr.hcl b/packer/templates/redis.pkr.hcl
new file mode 100644 (file)
index 0000000..f1c263a
--- /dev/null
@@ -0,0 +1,168 @@
+packer {
+  required_plugins {
+    openstack = {
+      version = ">= 1.0.0"
+      source  = "github.com/hashicorp/openstack"
+    }
+  }
+}
+
+variable "cloud_auth_url" {
+  type    = string
+  default = null
+}
+
+variable "cloud_tenant" {
+  type    = string
+  default = null
+}
+
+variable "cloud_user" {
+  type    = string
+  default = null
+}
+
+variable "cloud_pass" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_name" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_product_code" {
+  type    = string
+  default = null
+}
+
+variable "source_ami_filter_owner" {
+  type    = string
+  default = null
+}
+
+variable "ansible_roles_path" {
+  type    = string
+  default = ".galaxy"
+}
+
+variable "arch" {
+  type    = string
+  default = "x86_64"
+}
+
+variable "base_image" {
+  type = string
+  default = null
+}
+
+variable "cloud_network" {
+  type = string
+  default = null
+}
+
+variable "cloud_region" {
+  type    = string
+  default = "ca-ymq-1"
+}
+
+variable "cloud_user_data" {
+  type = string
+  default = null
+}
+
+variable "distro" {
+  type = string
+  default = null
+}
+
+variable "docker_source_image" {
+  type = string
+  default = null
+}
+
+variable "flavor" {
+  type    = string
+  default = "v2-highcpu-1"
+}
+
+variable "ssh_proxy_host" {
+  type    = string
+  default = ""
+}
+
+variable "ssh_user" {
+  type = string
+  default = null
+}
+
+variable "vm_image_disk_format" {
+  type    = string
+  default = ""
+}
+
+variable "vm_use_block_storage" {
+  type    = string
+  default = "true"
+}
+
+variable "vm_volume_size" {
+  type    = string
+  default = "20"
+}
+
+source "docker" "redis" {
+  changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"]
+  commit  = true
+  image   = "${var.docker_source_image}"
+}
+
+source "openstack" "redis" {
+  domain_name       = "Default"
+  flavor            = "v1-standard-1"
+  identity_endpoint = "${var.cloud_auth_url}"
+  image_name        = "${var.distro} - redis - ${var.arch} - ${legacy_isotime("20180101-1003")}"
+  metadata = {
+    ci_managed = "yes"
+  }
+  networks          = ["${var.cloud_network}"]
+  password          = "${var.cloud_pass}"
+  region            = "ca-ymq-1"
+  source_image_name = "${var.base_image}"
+  ssh_proxy_host    = "${var.ssh_proxy_host}"
+  ssh_username      = "${var.ssh_user}"
+  tenant_name       = "${var.cloud_tenant}"
+  user_data_file    = "${var.cloud_user_data}"
+  username          = "${var.cloud_user}"
+}
+
+build {
+  sources = ["source.docker.redis", "source.openstack.redis"]
+
+  provisioner "shell" {
+    execute_command = "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
+    scripts         = ["common-packer/provision/install-python.sh"]
+  }
+
+  provisioner "shell-local" {
+    command = "./common-packer/ansible-galaxy.sh ${var.ansible_roles_path}"
+  }
+
+  provisioner "ansible" {
+    ansible_env_vars   = [
+      "ANSIBLE_NOCOWS=1",
+      "ANSIBLE_PIPELINING=True",
+      "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+      "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+      "ANSIBLE_STDOUT_CALLBACK=debug"
+    ]
+    command            = "./common-packer/ansible-playbook.sh"
+    extra_arguments    = [
+      "--scp-extra-args", "'-O'",
+      "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"
+    ]
+    playbook_file      = "provision/redis.yaml"
+    skip_version_check = true
+  }
+}