From: Anil Belur Date: Thu, 29 Jun 2023 06:56:21 +0000 (+1000) Subject: Chore: Update common-packer to latest v0.14.0 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=releng%2Fbuilder.git;a=commitdiff_plain;h=6f9a5ad3b1c8dd961a8cb1904d90ac489d7e7a9f Chore: Update common-packer to latest v0.14.0 Create local templates in hcl2 format to work with packer updates. Add support for host key algorithms to work with local ssh proxy without which packer builds results in "failed to handshake" error. Workaround is to pass additional params with "extra_arguments". Change-Id: Ie716c3b844cf8a6adf5cd53e58ef92a3d22b82d2 Signed-off-by: Anil Belur --- diff --git a/packer/common-packer b/packer/common-packer index 15aba27a4..626eb9c0f 160000 --- a/packer/common-packer +++ b/packer/common-packer @@ -1 +1 @@ -Subproject commit 15aba27a45f98edb33890daa3712c6a4371b2947 +Subproject commit 626eb9c0fbfd8cbc8115aacfa21ef07f55695d54 diff --git a/packer/provision/devstack.yaml b/packer/provision/devstack-centos.yaml similarity index 85% rename from packer/provision/devstack.yaml rename to packer/provision/devstack-centos.yaml index ecad96747..0a893a075 100644 --- a/packer/provision/devstack.yaml +++ b/packer/provision/devstack-centos.yaml @@ -15,19 +15,12 @@ yum: name: - perl-XML-XPath - - python-pip - crudini state: present become: true - name: Installing non-baseline requirements yum: name: - - deltarpm - - python - - python-crypto - - python-devel - - python-lxml - - python-setuptools - libxml2-devel - libxslt-devel - libffi-devel diff --git a/packer/provision/devstack-pre-pip.yaml b/packer/provision/devstack-pre-pip-centos.yaml similarity index 95% rename from packer/provision/devstack-pre-pip.yaml rename to packer/provision/devstack-pre-pip-centos.yaml index 65566d353..fefe5647d 100644 --- a/packer/provision/devstack-pre-pip.yaml +++ b/packer/provision/devstack-pre-pip-centos.yaml @@ -15,19 +15,12 @@ yum: name: - perl-XML-XPath - - python-pip - crudini state: present become: true - name: Install non-baseline requirements yum: name: - - deltarpm - - python - - python-crypto - - python-devel - - python-lxml - - python-setuptools - libxml2-devel - libxslt-devel - libffi-devel diff --git a/packer/provision/local-windows-builder.yaml b/packer/provision/local-windows-builder.yaml new file mode 120000 index 000000000..5c3fc5c9f --- /dev/null +++ b/packer/provision/local-windows-builder.yaml @@ -0,0 +1 @@ +../common-packer/provision/local-windows-builder.yaml \ No newline at end of file diff --git a/packer/templates/builder.json b/packer/templates/builder.json index 51ebe88d9..8c7cb68ba 100644 --- a/packer/templates/builder.json +++ b/packer/templates/builder.json @@ -64,6 +64,11 @@ "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug" + ], + "extra_arguments": [ + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ] } ] diff --git a/packer/templates/builder.pkr.hcl b/packer/templates/builder.pkr.hcl new file mode 120000 index 000000000..8ea2d8721 --- /dev/null +++ b/packer/templates/builder.pkr.hcl @@ -0,0 +1 @@ +../common-packer/templates/builder.pkr.hcl \ No newline at end of file diff --git a/packer/templates/devstack-pre-pip-queens.json b/packer/templates/devstack-pre-pip-queens.json index 170bdc0c7..b774c67b9 100644 --- a/packer/templates/devstack-pre-pip-queens.json +++ b/packer/templates/devstack-pre-pip-queens.json @@ -54,7 +54,7 @@ }, { "type": "ansible", - "playbook_file": "provision/devstack-pre-pip.yaml", + "playbook_file": "provision/devstack-pre-pip-centos.yaml", "command": "./common-packer/ansible-playbook.sh", "skip_version_check": true, "ansible_env_vars": [ @@ -67,7 +67,10 @@ ], "extra_arguments": [ "--extra-vars", - "os_branch=stable/queens rdo_branch=queens" + "os_branch=stable/queens rdo_branch=queens", + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ] } ] diff --git a/packer/templates/devstack-pre-pip-queens.pkr.hcl b/packer/templates/devstack-pre-pip-queens.pkr.hcl new file mode 100644 index 000000000..a12c12e09 --- /dev/null +++ b/packer/templates/devstack-pre-pip-queens.pkr.hcl @@ -0,0 +1,168 @@ +packer { + required_plugins { + openstack = { + version = ">= 1.0.0" + source = "github.com/hashicorp/openstack" + } + } +} + +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_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 "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 = "v3-standard-2" +} + +variable "ssh_proxy_host" { + type = string + default = "" +} + +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 "ssh_user" { + type = string +} + +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" "devstack-pre-pip-queens" { + changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"] + commit = true + image = "${var.docker_source_image}" +} + +source "openstack" "devstack-pre-pip-queens" { + flavor = "${var.flavor}" + image_disk_format = "${var.vm_image_disk_format}" + image_name = "ZZCI - ${var.distro} - devstack-queens - ${var.arch} - ${legacy_isotime("20060102-150405.000")}" + instance_name = "${var.distro}-devstack-queens-${uuidv4()}" + metadata = { + ci_managed = "yes" + } + networks = ["${var.cloud_network}"] + region = "${var.cloud_region}" + source_image_name = "${var.base_image}" + ssh_proxy_host = "${var.ssh_proxy_host}" + ssh_username = "${var.ssh_user}" + use_blockstorage_volume = "${var.vm_use_block_storage}" + user_data_file = "${var.cloud_user_data}" + volume_size = "${var.vm_volume_size}" +} + +build { + sources = ["source.docker.devstack-pre-pip-queens", "source.openstack.devstack-pre-pip-queens"] + + 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_DEBUG=False", + "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 = [ + "--extra-vars", "os_branch=stable/queens rdo_branch=queens", + "--scp-extra-args", "'-O'", + "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" + ] + playbook_file = "provision/devstack-pre-pip-centos.yaml" + skip_version_check = true + } +} diff --git a/packer/templates/devstack-pre-pip-rocky.json b/packer/templates/devstack-pre-pip-rocky.json index 175f82e43..a6e68084b 100644 --- a/packer/templates/devstack-pre-pip-rocky.json +++ b/packer/templates/devstack-pre-pip-rocky.json @@ -55,7 +55,7 @@ }, { "type": "ansible", - "playbook_file": "provision/devstack-pre-pip.yaml", + "playbook_file": "provision/devstack-pre-pip-centos.yaml", "command": "./common-packer/ansible-playbook.sh", "skip_version_check": true, "ansible_env_vars": [ @@ -68,7 +68,10 @@ ], "extra_arguments": [ "--extra-vars", - "os_branch=stable/rocky rdo_branch=rocky" + "os_branch=stable/queens rdo_branch=queens", + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ] } ] diff --git a/packer/templates/devstack-pre-pip-rocky.pkr.hcl b/packer/templates/devstack-pre-pip-rocky.pkr.hcl new file mode 100644 index 000000000..e65dc5411 --- /dev/null +++ b/packer/templates/devstack-pre-pip-rocky.pkr.hcl @@ -0,0 +1,168 @@ +packer { + required_plugins { + openstack = { + version = ">= 1.0.0" + source = "github.com/hashicorp/openstack" + } + } +} + +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_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 "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 = "v3-standard-2" +} + +variable "ssh_proxy_host" { + type = string + default = "" +} + +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 "ssh_user" { + type = string +} + +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" "devstack-pre-pip-rocky" { + changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"] + commit = true + image = "${var.docker_source_image}" +} + +source "openstack" "devstack-pre-pip-rocky" { + flavor = "${var.flavor}" + image_disk_format = "${var.vm_image_disk_format}" + image_name = "ZZCI - ${var.distro} - devstack-rocky - ${var.arch} - ${legacy_isotime("20060102-150405.000")}" + instance_name = "${var.distro}-devstack-rocky-${uuidv4()}" + metadata = { + ci_managed = "yes" + } + networks = ["${var.cloud_network}"] + region = "${var.cloud_region}" + source_image_name = "${var.base_image}" + ssh_proxy_host = "${var.ssh_proxy_host}" + ssh_username = "${var.ssh_user}" + use_blockstorage_volume = "${var.vm_use_block_storage}" + user_data_file = "${var.cloud_user_data}" + volume_size = "${var.vm_volume_size}" +} + +build { + sources = ["source.docker.devstack-pre-pip-rocky", "source.openstack.devstack-pre-pip-rocky"] + + 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_DEBUG=False", + "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 = [ + "--extra-vars", "os_branch=stable/queens rdo_branch=queens", + "--scp-extra-args", "'-O'", + "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" + ] + playbook_file = "provision/devstack-pre-pip-centos.yaml" + skip_version_check = true + } +} diff --git a/packer/templates/devstack-pre-pip-stein.json b/packer/templates/devstack-pre-pip-stein.json index 9abb28f4a..18f9f24f2 100644 --- a/packer/templates/devstack-pre-pip-stein.json +++ b/packer/templates/devstack-pre-pip-stein.json @@ -55,7 +55,7 @@ }, { "type": "ansible", - "playbook_file": "provision/devstack-pre-pip.yaml", + "playbook_file": "provision/devstack-pre-pip-centos.yaml", "command": "./common-packer/ansible-playbook.sh", "skip_version_check": true, "ansible_env_vars": [ @@ -68,7 +68,10 @@ ], "extra_arguments": [ "--extra-vars", - "os_branch=stable/stein rdo_branch=stein" + "os_branch=stable/queens rdo_branch=queens", + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ] } ] diff --git a/packer/templates/devstack-pre-pip-stein.pkr.hcl b/packer/templates/devstack-pre-pip-stein.pkr.hcl new file mode 100644 index 000000000..796be7a6b --- /dev/null +++ b/packer/templates/devstack-pre-pip-stein.pkr.hcl @@ -0,0 +1,157 @@ +packer { + required_plugins { + openstack = { + version = ">= 1.0.0" + source = "github.com/hashicorp/openstack" + } + } +} + +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_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 "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 = "v3-standard-2" +} + +variable "ssh_proxy_host" { + type = string + default = "" +} + +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 "ssh_user" { + type = string +} + +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" "devstack-pre-pip-stein" { + changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"] + commit = true + image = "${var.docker_source_image}" +} + +source "openstack" "devstack-pre-pip-stein" { + flavor = "${var.flavor}" + image_disk_format = "${var.vm_image_disk_format}" + image_name = "ZZCI - ${var.distro} - devstack-stein - ${var.arch} - ${legacy_isotime("20060102-150405.000")}" + instance_name = "${var.distro}-devstack-stein-${uuidv4()}" + metadata = { + ci_managed = "yes" + } + networks = ["${var.cloud_network}"] + region = "${var.cloud_region}" + source_image_name = "${var.base_image}" + ssh_proxy_host = "${var.ssh_proxy_host}" + ssh_username = "${var.ssh_user}" + use_blockstorage_volume = "${var.vm_use_block_storage}" + user_data_file = "${var.cloud_user_data}" + volume_size = "${var.vm_volume_size}" +} + +build { + sources = ["source.docker.devstack-pre-pip-stein", "source.openstack.devstack-pre-pip-stein"] + + 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_DEBUG=False", "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 = ["--extra-vars", "os_branch=stable/queens rdo_branch=queens", "--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"] + playbook_file = "provision/devstack-pre-pip-centos.yaml" + skip_version_check = true + } +} diff --git a/packer/templates/devstack-pre-pip-yoga.json b/packer/templates/devstack-pre-pip-yoga.json new file mode 100644 index 000000000..8c406cdf2 --- /dev/null +++ b/packer/templates/devstack-pre-pip-yoga.json @@ -0,0 +1,78 @@ +{ + "variables": { + "ansible_roles_path": ".galaxy", + "arch": "x86_64", + "base_image": null, + "cloud_network": null, + "cloud_user_data": null, + "cloud_region": "ca-ymq-1", + "vm_use_block_storage": "true", + "vm_volume_size": "20", + "vm_image_disk_format": "", + "distro": null, + "docker_source_image": null, + "flavor": "v3-standard-2", + "ssh_user": null, + "ssh_proxy_host": "" + }, + "builders": [ + { + "name": "openstack", + "image_name": "ZZCI - {{user `distro`}} - devstack-yoga - {{user `arch`}} - {{isotime \"20060102-150405.000\"}}", + "instance_name": "{{user `distro`}}-devstack-yoga-{{uuid}}", + "source_image_name": "{{user `base_image`}}", + "type": "openstack", + "region": "{{user `cloud_region`}}", + "networks": ["{{user `cloud_network`}}"], + "user_data_file": "{{user `cloud_user_data`}}", + "ssh_username": "{{user `ssh_user`}}", + "ssh_proxy_host": "{{user `ssh_proxy_host`}}", + "flavor": "{{user `flavor`}}", + "metadata": { + "ci_managed": "yes" + }, + "use_blockstorage_volume": "{{user `vm_use_block_storage`}}", + "volume_size": "{{user `vm_volume_size`}}", + "image_disk_format": "{{user `vm_image_disk_format`}}" + }, + { + "name": "docker", + "type": "docker", + "image": "{{ user `docker_source_image` }}", + "commit": true, + "changes": ["ENTRYPOINT [\"\"]", "CMD [\"\"]"] + } + ], + "provisioners": [ + { + "type": "shell", + "scripts": ["common-packer/provision/install-python.sh"], + "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi" + }, + { + "type": "shell-local", + "command": "./common-packer/ansible-galaxy.sh {{user `ansible_roles_path`}}" + }, + { + "type": "ansible", + "playbook_file": "provision/devstack-pre-pip-centos.yaml", + "command": "./common-packer/ansible-playbook.sh", + "skip_version_check": true, + "ansible_env_vars": [ + "ANSIBLE_DEBUG=False", + "ANSIBLE_NOCOWS=1", + "ANSIBLE_PIPELINING=True", + "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}", + "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", + "ANSIBLE_STDOUT_CALLBACK=debug" + ], + "extra_arguments": [ + "--extra-vars", + "os_branch=stable/yoga rdo_branch=yoga", + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" + ] + } + ] +} diff --git a/packer/templates/devstack-pre-pip-yoga.pkr.hcl b/packer/templates/devstack-pre-pip-yoga.pkr.hcl new file mode 100644 index 000000000..030fb3f49 --- /dev/null +++ b/packer/templates/devstack-pre-pip-yoga.pkr.hcl @@ -0,0 +1,157 @@ +packer { + required_plugins { + openstack = { + version = ">= 1.0.0" + source = "github.com/hashicorp/openstack" + } + } +} + +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_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 "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 = "v3-standard-2" +} + +variable "ssh_proxy_host" { + type = string + default = "" +} + +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 "ssh_user" { + type = string +} + +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" "devstack-pre-pip-yoga" { + changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"] + commit = true + image = "${var.docker_source_image}" +} + +source "openstack" "devstack-pre-pip-yoga" { + flavor = "${var.flavor}" + image_disk_format = "${var.vm_image_disk_format}" + image_name = "ZZCI - ${var.distro} - devstack-yoga - ${var.arch} - ${legacy_isotime("20060102-150405.000")}" + instance_name = "${var.distro}-devstack-yoga-${uuidv4()}" + metadata = { + ci_managed = "yes" + } + networks = ["${var.cloud_network}"] + region = "${var.cloud_region}" + source_image_name = "${var.base_image}" + ssh_proxy_host = "${var.ssh_proxy_host}" + ssh_username = "${var.ssh_user}" + use_blockstorage_volume = "${var.vm_use_block_storage}" + user_data_file = "${var.cloud_user_data}" + volume_size = "${var.vm_volume_size}" +} + +build { + sources = ["source.docker.devstack-pre-pip-yoga", "source.openstack.devstack-pre-pip-yoga"] + + 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_DEBUG=False", "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 = ["--extra-vars", "os_branch=stable/yoga rdo_branch=yoga", "--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"] + playbook_file = "provision/devstack-pre-pip-centos.yaml" + skip_version_check = true + } +} diff --git a/packer/templates/devstack.json b/packer/templates/devstack.json index 98a1f13e0..ba82499f8 100644 --- a/packer/templates/devstack.json +++ b/packer/templates/devstack.json @@ -55,7 +55,7 @@ }, { "type": "ansible", - "playbook_file": "provision/devstack.yaml", + "playbook_file": "provision/devstack-centos.yaml", "command": "./common-packer/ansible-playbook.sh", "skip_version_check": true, "ansible_env_vars": [ @@ -64,6 +64,11 @@ "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug" + ], + "extra_arguments": [ + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ] } ] diff --git a/packer/templates/devstack.pkr.hcl b/packer/templates/devstack.pkr.hcl new file mode 100644 index 000000000..9a815e51f --- /dev/null +++ b/packer/templates/devstack.pkr.hcl @@ -0,0 +1,157 @@ +packer { + required_plugins { + openstack = { + version = ">= 1.0.0" + source = "github.com/hashicorp/openstack" + } + } +} + +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_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 "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 = "v3-standard-2" +} + +variable "ssh_proxy_host" { + type = string + default = "" +} + +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 "ssh_user" { + type = string +} + +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" "devstack" { + changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"] + commit = true + image = "${var.docker_source_image}" +} + +source "openstack" "devstack" { + flavor = "${var.flavor}" + image_disk_format = "${var.vm_image_disk_format}" + image_name = "ZZCI - ${var.distro} - devstack - ${var.arch} - ${legacy_isotime("20060102-150405.000")}" + instance_name = "${var.distro}-devstack-${uuidv4()}" + metadata = { + ci_managed = "yes" + } + networks = ["${var.cloud_network}"] + region = "${var.cloud_region}" + source_image_name = "${var.base_image}" + ssh_proxy_host = "${var.ssh_proxy_host}" + ssh_username = "${var.ssh_user}" + use_blockstorage_volume = "${var.vm_use_block_storage}" + user_data_file = "${var.cloud_user_data}" + volume_size = "${var.vm_volume_size}" +} + +build { + sources = ["source.docker.devstack", "source.openstack.devstack"] + + 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/devstack-centos.yaml" + skip_version_check = true + } +} diff --git a/packer/templates/docker.pkr.hcl b/packer/templates/docker.pkr.hcl new file mode 120000 index 000000000..08567dfdd --- /dev/null +++ b/packer/templates/docker.pkr.hcl @@ -0,0 +1 @@ +../common-packer/templates/docker.pkr.hcl \ No newline at end of file diff --git a/packer/templates/helm.json b/packer/templates/helm.json index f45c042d7..53543d350 100644 --- a/packer/templates/helm.json +++ b/packer/templates/helm.json @@ -72,6 +72,11 @@ "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug" + ], + "extra_arguments": [ + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ] } ] diff --git a/packer/templates/helm.pkr.hcl b/packer/templates/helm.pkr.hcl new file mode 100644 index 000000000..d5bf31286 --- /dev/null +++ b/packer/templates/helm.pkr.hcl @@ -0,0 +1,165 @@ +packer { + required_plugins { + openstack = { + version = ">= 1.0.0" + source = "github.com/hashicorp/openstack" + } + } +} + +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_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 "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 = "v3-standard-2" +} + +variable "ssh_proxy_host" { + type = string + default = "" +} + +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 "ssh_user" { + type = string +} + +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 = "v1-standard-1" + identity_endpoint = "${var.cloud_auth_url}" + image_disk_format = "${var.vm_image_disk_format}" + 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}" + use_blockstorage_volume = "${var.vm_use_block_storage}" + user_data_file = "${var.cloud_user_data}" + username = "${var.cloud_user}" + volume_size = "${var.vm_volume_size}" +} + +# a build block invokes sources and runs provisioning steps on them. The +# documentation for build blocks can be found here: +# https://www.packer.io/docs/templates/hcl_templates/blocks/build +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/mininet-ovs-2.8.json b/packer/templates/mininet-ovs-2.8.json index 9c0847160..29c5aba1e 100644 --- a/packer/templates/mininet-ovs-2.8.json +++ b/packer/templates/mininet-ovs-2.8.json @@ -64,6 +64,11 @@ "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug" + ], + "extra_arguments": [ + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ] } ] diff --git a/packer/templates/mininet-ovs-2.8.pkr.hcl b/packer/templates/mininet-ovs-2.8.pkr.hcl new file mode 100644 index 000000000..c41478fc3 --- /dev/null +++ b/packer/templates/mininet-ovs-2.8.pkr.hcl @@ -0,0 +1,156 @@ +packer { + required_plugins { + openstack = { + version = ">= 1.0.0" + source = "github.com/hashicorp/openstack" + } + } +} +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_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 "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 = "v3-standard-2" +} + +variable "ssh_proxy_host" { + type = string + default = "" +} + +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 "ssh_user" { + type = string +} + +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" "mininet-ovs-28" { + changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"] + commit = true + image = "${var.docker_source_image}" +} + +source "openstack" "mininet-ovs-28" { + flavor = "${var.flavor}" + image_disk_format = "${var.vm_image_disk_format}" + image_name = "ZZCI - ${var.distro} - mininet-ovs-28 - ${var.arch} - ${legacy_isotime("20060102-150405.000")}" + instance_name = "${var.distro}-mininet-ovs-28-${uuidv4()}" + metadata = { + ci_managed = "yes" + } + networks = ["${var.cloud_network}"] + region = "${var.cloud_region}" + source_image_name = "${var.base_image}" + ssh_proxy_host = "${var.ssh_proxy_host}" + ssh_username = "${var.ssh_user}" + use_blockstorage_volume = "${var.vm_use_block_storage}" + user_data_file = "${var.cloud_user_data}" + volume_size = "${var.vm_volume_size}" +} + +build { + sources = ["source.docker.mininet-ovs-28", "source.openstack.mininet-ovs-28"] + + 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/mininet-ovs-2.8.yaml" + skip_version_check = true + } +} diff --git a/packer/templates/robot.json b/packer/templates/robot.json index 17937e2c0..3b9c75ec4 100644 --- a/packer/templates/robot.json +++ b/packer/templates/robot.json @@ -64,6 +64,11 @@ "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug" + ], + "extra_arguments": [ + "--scp-extra-args", "'-O'", + "--ssh-extra-args", + "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ] } ] diff --git a/packer/templates/robot.pkr.hcl b/packer/templates/robot.pkr.hcl new file mode 100644 index 000000000..0815d964d --- /dev/null +++ b/packer/templates/robot.pkr.hcl @@ -0,0 +1,157 @@ +packer { + required_plugins { + openstack = { + version = ">= 1.0.0" + source = "github.com/hashicorp/openstack" + } + } +} + +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_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 "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 = "v3-standard-2" +} + +variable "ssh_proxy_host" { + type = string + default = "" +} + +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 "ssh_user" { + type = string +} + +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" "robot" { + changes = ["ENTRYPOINT [\"\"]", "CMD [\"\"]"] + commit = true + image = "${var.docker_source_image}" +} + +source "openstack" "robot" { + flavor = "${var.flavor}" + image_disk_format = "${var.vm_image_disk_format}" + image_name = "ZZCI - ${var.distro} - robot - ${var.arch} - ${legacy_isotime("20060102-150405.000")}" + instance_name = "${var.distro}-robot-${uuidv4()}" + metadata = { + ci_managed = "yes" + } + networks = ["${var.cloud_network}"] + region = "${var.cloud_region}" + source_image_name = "${var.base_image}" + ssh_proxy_host = "${var.ssh_proxy_host}" + ssh_username = "${var.ssh_user}" + use_blockstorage_volume = "${var.vm_use_block_storage}" + user_data_file = "${var.cloud_user_data}" + volume_size = "${var.vm_volume_size}" +} + +build { + sources = ["source.docker.robot", "source.openstack.robot"] + + 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/robot.yaml" + skip_version_check = true + } +}