aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra/packer-aws-sut
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-07-13 08:42:42 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-07-13 09:23:55 +0000
commitefe51d995a9d736ce194dbd1c850d4a09e0a1506 (patch)
treeff3cf08ce37caaf9579a86d5b8ea558af9197980 /fdio.infra/packer-aws-sut
parent192e1ac1f274d8eed3d33cdbc15fa995a74247c7 (diff)
feat(packer): Cleanup
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: I947f0e349584c3688e207a910e0debfc87562af6
Diffstat (limited to 'fdio.infra/packer-aws-sut')
-rw-r--r--fdio.infra/packer-aws-sut/ubuntu_jammy_arm.pkr.hcl128
-rw-r--r--fdio.infra/packer-aws-sut/ubuntu_jammy_x86.pkr.hcl128
2 files changed, 256 insertions, 0 deletions
diff --git a/fdio.infra/packer-aws-sut/ubuntu_jammy_arm.pkr.hcl b/fdio.infra/packer-aws-sut/ubuntu_jammy_arm.pkr.hcl
new file mode 100644
index 0000000000..6e612f1fc4
--- /dev/null
+++ b/fdio.infra/packer-aws-sut/ubuntu_jammy_arm.pkr.hcl
@@ -0,0 +1,128 @@
+packer {
+ required_plugins {
+ amazon = {
+ version = ">= 1.2.6"
+ source = "github.com/hashicorp/amazon"
+ }
+ }
+}
+
+variable "first_run_commands" {
+ description = "Commands to run before deployment via remote-exec"
+ type = list(string)
+ default = [
+ ""
+ ]
+}
+
+variable "last_run_commands" {
+ description = "Commands to run after deployment via remote-exec"
+ type = list(string)
+ default = [
+ "sudo sed -i 's/Unattended-Upgrade \"1\"/Unattended-Upgrade \"0\"/g' /etc/apt/apt.conf.d/20auto-upgrades"
+ ]
+}
+
+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_c6gn_ubuntu_jammy_sut" {
+ ami_name = "csit_c6gn_ubuntu_jammy_sut"
+ ami_description = "CSIT SUT image based on Ubuntu jammy"
+ ena_support = true
+ instance_type = "c6gn.4xlarge"
+ 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_c6gn_ubuntu_jammy_tg" {
+ ami_name = "csit_c6gn_ubuntu_jammy_tg"
+ ami_description = "CSIT TG image based on Ubuntu jammy"
+ ena_support = true
+ instance_type = "c6gn.4xlarge"
+ 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_c6gn_ubuntu_jammy_sut-packer"
+ sources = [
+ "source.amazon-ebs.csit_c6gn_ubuntu_jammy_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"
+ ]
+ }
+ provisioner "shell" {
+ inline = var.last_run_commands
+ }
+}
+
+build {
+ name = "csit_c6gn_ubuntu_jammy_tg-packer"
+ sources = [
+ "source.amazon-ebs.csit_c6gn_ubuntu_jammy_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"
+ ]
+ }
+ provisioner "shell" {
+ inline = var.last_run_commands
+ }
+}
diff --git a/fdio.infra/packer-aws-sut/ubuntu_jammy_x86.pkr.hcl b/fdio.infra/packer-aws-sut/ubuntu_jammy_x86.pkr.hcl
new file mode 100644
index 0000000000..376e1c324f
--- /dev/null
+++ b/fdio.infra/packer-aws-sut/ubuntu_jammy_x86.pkr.hcl
@@ -0,0 +1,128 @@
+packer {
+ required_plugins {
+ amazon = {
+ version = ">= 1.2.6"
+ source = "github.com/hashicorp/amazon"
+ }
+ }
+}
+
+variable "first_run_commands" {
+ description = "Commands to run before deployment via remote-exec"
+ type = list(string)
+ default = [
+ ""
+ ]
+}
+
+variable "last_run_commands" {
+ description = "Commands to run after deployment via remote-exec"
+ type = list(string)
+ default = [
+ "sudo sed -i 's/Unattended-Upgrade \"1\"/Unattended-Upgrade \"0\"/g' /etc/apt/apt.conf.d/20auto-upgrades"
+ ]
+}
+
+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_jammy_sut" {
+ ami_name = "csit_c5n_ubuntu_jammy_sut"
+ ami_description = "CSIT SUT image based on Ubuntu Jammy"
+ ena_support = true
+ instance_type = "c5n.4xlarge"
+ 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-04e601abe3e1a910f"
+ ssh_username = "ubuntu"
+}
+
+source "amazon-ebs" "csit_c5n_ubuntu_jammy_tg" {
+ ami_name = "csit_c5n_ubuntu_jammy_tg"
+ ami_description = "CSIT TG image based on Ubuntu Jammy"
+ ena_support = true
+ instance_type = "c5n.4xlarge"
+ 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-04e601abe3e1a910f"
+ ssh_username = "ubuntu"
+}
+
+build {
+ name = "csit_c5n_ubuntu_jammy_sut-packer"
+ sources = [
+ "source.amazon-ebs.csit_c5n_ubuntu_jammy_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"
+ ]
+ }
+ provisioner "shell" {
+ inline = var.last_run_commands
+ }
+}
+
+build {
+ name = "csit_c5n_ubuntu_jammy_tg-packer"
+ sources = [
+ "source.amazon-ebs.csit_c5n_ubuntu_jammy_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"
+ ]
+ }
+ provisioner "shell" {
+ inline = var.last_run_commands
+ }
+}