From 6f9f70d7bb1bbed37ff1495c20d11a03b82b9951 Mon Sep 17 00:00:00 2001 From: pmikus Date: Wed, 6 Oct 2021 12:53:37 +0000 Subject: feat(Packer): Introduce AMI packer images Signed-off-by: pmikus Change-Id: I471069fd4cc10a0627434a60b4627d1bd0e192b8 --- fdio.infra.packer/2n_aws_c5n/ubuntu_focal.pkr.hcl | 114 ++++++++++++++++++++++ fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl | 114 ++++++++++++++++++++++ 2 files changed, 228 insertions(+) create mode 100644 fdio.infra.packer/2n_aws_c5n/ubuntu_focal.pkr.hcl create mode 100644 fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl (limited to 'fdio.infra.packer') diff --git a/fdio.infra.packer/2n_aws_c5n/ubuntu_focal.pkr.hcl b/fdio.infra.packer/2n_aws_c5n/ubuntu_focal.pkr.hcl new file mode 100644 index 0000000000..0fc3f36907 --- /dev/null +++ b/fdio.infra.packer/2n_aws_c5n/ubuntu_focal.pkr.hcl @@ -0,0 +1,114 @@ +packer { + required_plugins { + amazon = { + version = ">= 1.0.1" + source = "github.com/hashicorp/amazon" + } + } +} + +variable "first_run_commands" { + description = "Commands to run after deployment via remote-exec" + type = list(string) + default = [ + "" + ] +} + +variable "ansible_file_path" { + description = "Path to Ansible playbook" + type = string + default = "../../fdio.infra.ansible/site.yaml" +} + +variable "ansible_python_executable" { + description = "Path to Python interpreter" + type = string + default = "/usr/bin/python3" +} + +variable "ansible_topology_path" { + description = "Path to Ansible playbook which creates a topology file" + type = string + default = "../../fdio.infra.ansible/cloud_topology.yaml" +} + +variable "ansible_provision_pwd" { + description = "Password used for ansible provisioning (ansible_ssh_pass)" + type = string + default = "Csit1234" +} + +source "amazon-ebs" "csit_c5n_ubuntu_focal_sut" { + ami_name = "csit_c5n_ubuntu_focal_sut" + ami_description = "CSIT SUT image based on Ubuntu Focal" + ena_support = true + instance_type = "c5n.9xlarge" + launch_block_device_mappings { + device_name = "/dev/sda1" + volume_size = 40 + volume_type = "gp2" + } + force_deregister = true + region = "eu-central-1" + skip_create_ami = false + source_ami = "ami-0a875db8a031a9efb" + ssh_username = "ubuntu" +} + +source "amazon-ebs" "csit_c5n_ubuntu_focal_tg" { + ami_name = "csit_c5n_ubuntu_focal_tg" + ami_description = "CSIT TG image based on Ubuntu Focal" + ena_support = true + instance_type = "c5n.9xlarge" + launch_block_device_mappings { + device_name = "/dev/sda1" + volume_size = 40 + volume_type = "gp2" + } + force_deregister = true + region = "eu-central-1" + skip_create_ami = false + source_ami = "ami-0a875db8a031a9efb" + ssh_username = "ubuntu" +} + +build { + name = "csit_c5n_ubuntu_focal_sut-packer" + sources = [ + "source.amazon-ebs.csit_c5n_ubuntu_focal_sut" + ] + provisioner "shell" { + inline = var.first_run_commands + } + provisioner "ansible" { + playbook_file = var.ansible_file_path + user = "ubuntu" + groups = ["sut_aws"] + extra_arguments = [ + "--extra-vars", "ansible_ssh_pass=${var.ansible_provision_pwd}", + "--extra-vars", "ansible_python_interpreter=${var.ansible_python_executable}", + "--extra-vars", "aws=true" + ] + } +} + +build { + name = "csit_c5n_ubuntu_focal_tg-packer" + sources = [ + "source.amazon-ebs.csit_c5n_ubuntu_focal_tg" + ] + provisioner "shell" { + inline = var.first_run_commands + } + provisioner "ansible" { + playbook_file = var.ansible_file_path + user = "ubuntu" + groups = ["tg_aws"] + extra_arguments = [ + "--extra-vars", "ansible_ssh_pass=${var.ansible_provision_pwd}", + "--extra-vars", "ansible_python_interpreter=${var.ansible_python_executable}", + "--extra-vars", "aws=true" + ] + } +} diff --git a/fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl b/fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl new file mode 100644 index 0000000000..0fc3f36907 --- /dev/null +++ b/fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl @@ -0,0 +1,114 @@ +packer { + required_plugins { + amazon = { + version = ">= 1.0.1" + source = "github.com/hashicorp/amazon" + } + } +} + +variable "first_run_commands" { + description = "Commands to run after deployment via remote-exec" + type = list(string) + default = [ + "" + ] +} + +variable "ansible_file_path" { + description = "Path to Ansible playbook" + type = string + default = "../../fdio.infra.ansible/site.yaml" +} + +variable "ansible_python_executable" { + description = "Path to Python interpreter" + type = string + default = "/usr/bin/python3" +} + +variable "ansible_topology_path" { + description = "Path to Ansible playbook which creates a topology file" + type = string + default = "../../fdio.infra.ansible/cloud_topology.yaml" +} + +variable "ansible_provision_pwd" { + description = "Password used for ansible provisioning (ansible_ssh_pass)" + type = string + default = "Csit1234" +} + +source "amazon-ebs" "csit_c5n_ubuntu_focal_sut" { + ami_name = "csit_c5n_ubuntu_focal_sut" + ami_description = "CSIT SUT image based on Ubuntu Focal" + ena_support = true + instance_type = "c5n.9xlarge" + launch_block_device_mappings { + device_name = "/dev/sda1" + volume_size = 40 + volume_type = "gp2" + } + force_deregister = true + region = "eu-central-1" + skip_create_ami = false + source_ami = "ami-0a875db8a031a9efb" + ssh_username = "ubuntu" +} + +source "amazon-ebs" "csit_c5n_ubuntu_focal_tg" { + ami_name = "csit_c5n_ubuntu_focal_tg" + ami_description = "CSIT TG image based on Ubuntu Focal" + ena_support = true + instance_type = "c5n.9xlarge" + launch_block_device_mappings { + device_name = "/dev/sda1" + volume_size = 40 + volume_type = "gp2" + } + force_deregister = true + region = "eu-central-1" + skip_create_ami = false + source_ami = "ami-0a875db8a031a9efb" + ssh_username = "ubuntu" +} + +build { + name = "csit_c5n_ubuntu_focal_sut-packer" + sources = [ + "source.amazon-ebs.csit_c5n_ubuntu_focal_sut" + ] + provisioner "shell" { + inline = var.first_run_commands + } + provisioner "ansible" { + playbook_file = var.ansible_file_path + user = "ubuntu" + groups = ["sut_aws"] + extra_arguments = [ + "--extra-vars", "ansible_ssh_pass=${var.ansible_provision_pwd}", + "--extra-vars", "ansible_python_interpreter=${var.ansible_python_executable}", + "--extra-vars", "aws=true" + ] + } +} + +build { + name = "csit_c5n_ubuntu_focal_tg-packer" + sources = [ + "source.amazon-ebs.csit_c5n_ubuntu_focal_tg" + ] + provisioner "shell" { + inline = var.first_run_commands + } + provisioner "ansible" { + playbook_file = var.ansible_file_path + user = "ubuntu" + groups = ["tg_aws"] + extra_arguments = [ + "--extra-vars", "ansible_ssh_pass=${var.ansible_provision_pwd}", + "--extra-vars", "ansible_python_interpreter=${var.ansible_python_executable}", + "--extra-vars", "aws=true" + ] + } +} -- cgit 1.2.3-korg