fix(infra): New AWS images 14/42114/2
authorPeter Mikus <[email protected]>
Thu, 9 Jan 2025 10:15:07 +0000 (11:15 +0100)
committerPeter Mikus <[email protected]>
Thu, 9 Jan 2025 10:20:29 +0000 (10:20 +0000)
Signed-off-by: Peter Mikus <[email protected]>
Change-Id: Ib50df500ef28ceb40d9f9d8d05e31a16b484fa93

fdio.infra.ansible/roles/aws/tasks/main.yaml
fdio.infra.terraform/terraform-aws-1n-aws-c5n/variables.tf
fdio.infra.terraform/terraform-aws-1n-c6in/variables.tf
fdio.infra.terraform/terraform-aws-2n-aws-c5n/variables.tf
fdio.infra.terraform/terraform-aws-2n-c6in/variables.tf
fdio.infra.terraform/terraform-aws-2n-c7gn/variables.tf
fdio.infra/packer-aws-sut/ubuntu_noble_x86.pkr.hcl

index 47b8c10..d6304f8 100644 (file)
   tags:
     - conf-ssh
 
+- name: "Enable Password Less sudo"
+  ansible.builtin.lineinfile:
+    dest: "/etc/ssh/sshd_config"
+    regexp: "^#PermitRootLogin prohibit-password"
+    line: "PermitRootLogin yes"
+  tags:
+    - conf-ssh
+
 - name: "Recursively Delete Other Configs"
   ansible.builtin.file:
     path: "/etc/ssh/sshd_config.d"
     validate: "/usr/sbin/visudo -cf %s"
   tags:
     - aws-sudoers
+
+- name: "sudoers nopasswd"
+  ansible.builtin.lineinfile:
+    path: "/etc/sudoers"
+    state: "present"
+    line: "%testuser ALL=(ALL) NOPASSWD: ALL"
+    validate: "/usr/sbin/visudo -cf %s"
+  tags:
+    - aws-sudoers
\ No newline at end of file
index 5016b93..7b054d5 100644 (file)
@@ -38,7 +38,7 @@ variable "placement_group_strategy" {
 variable "tg_ami" {
   description = "AMI to use for the instance."
   type        = string
-  default     = "ami-0c18f927fc6ac6c52"
+  default     = "ami-04f5fbbd9880e691a"
 }
 
 variable "tg_associate_public_ip_address" {
index f9cd5bc..efdbe91 100644 (file)
@@ -38,7 +38,7 @@ variable "placement_group_strategy" {
 variable "tg_ami" {
   description = "AMI to use for the instance."
   type        = string
-  default     = "ami-0c18f927fc6ac6c52"
+  default     = "ami-04f5fbbd9880e691a"
 }
 
 variable "tg_associate_public_ip_address" {
index 0962997..a498645 100644 (file)
@@ -38,7 +38,7 @@ variable "placement_group_strategy" {
 variable "tg_ami" {
   description = "AMI to use for the instance."
   type        = string
-  default     = "ami-0c18f927fc6ac6c52"
+  default     = "ami-04f5fbbd9880e691a"
 }
 
 variable "tg_associate_public_ip_address" {
@@ -74,7 +74,7 @@ variable "tg_source_dest_check" {
 variable "sut1_ami" {
   description = "AMI to use for the instance."
   type        = string
-  default     = "ami-0269b92e0a5932902"
+  default     = "ami-01d325fa583a17daa"
 }
 
 variable "sut1_associate_public_ip_address" {
index 9f14b5b..b901fca 100644 (file)
@@ -86,7 +86,7 @@ variable "tg_source_dest_check" {
 variable "sut1_ami" {
   description = "AMI to use for the instance."
   type        = string
-  default     = "ami-0269b92e0a5932902"
+  default     = "ami-01d325fa583a17daa"
 }
 
 variable "sut1_associate_public_ip_address" {
index 1bdb701..0cc9252 100644 (file)
@@ -38,7 +38,7 @@ variable "placement_group_strategy" {
 variable "tg_ami" {
   description = "AMI to use for the instance."
   type        = string
-  default     = "ami-0c18f927fc6ac6c52"
+  default     = "ami-04f5fbbd9880e691a"
 }
 
 variable "tg_associate_public_ip_address" {
index 93e6d08..a9e0dc7 100644 (file)
@@ -15,7 +15,7 @@ variable "first_run_commands" {
   ]
 }
 
-variable "last_run_commands" {
+variable "last_run_commands_sut" {
   description = "Commands to run after deployment via remote-exec"
   type        = list(string)
   default = [
@@ -23,6 +23,15 @@ variable "last_run_commands" {
   ]
 }
 
+variable "last_run_commands_tg" {
+  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",
+    "sudo systemctl start csit-initialize-docker-tg.service"
+  ]
+}
+
 variable "ansible_file_path" {
   description = "Path to Ansible playbook"
   type        = string
@@ -51,7 +60,7 @@ source "amazon-ebs" "csit_ubuntu_noble_x86_sut" {
   ami_name        = "csit_ubuntu_noble_x86_sut"
   ami_description = "CSIT SUT image based on Ubuntu noble"
   ena_support     = true
-  instance_type   = "c5n.4xlarge"
+  instance_type   = "c6in.4xlarge"
   launch_block_device_mappings {
     device_name = "/dev/sda1"
     volume_size = 40
@@ -62,14 +71,14 @@ source "amazon-ebs" "csit_ubuntu_noble_x86_sut" {
   skip_create_ami  = false
   source_ami       = "ami-0084a47cc718c111a"
   ssh_username     = "ubuntu"
-  ssh_timeout      = "30m"
+  ssh_timeout      = "60m"
 }
 
 source "amazon-ebs" "csit_ubuntu_noble_x86_tg" {
   ami_name        = "csit_ubuntu_noble_x86_tg"
   ami_description = "CSIT TG image based on Ubuntu noble"
   ena_support     = true
-  instance_type   = "c5n.4xlarge"
+  instance_type   = "c6in.4xlarge"
   launch_block_device_mappings {
     device_name = "/dev/sda1"
     volume_size = 40
@@ -80,31 +89,31 @@ source "amazon-ebs" "csit_ubuntu_noble_x86_tg" {
   skip_create_ami  = false
   source_ami       = "ami-0084a47cc718c111a"
   ssh_username     = "ubuntu"
-  ssh_timeout      = "30m"
+  ssh_timeout      = "60m"
 }
 
-#build {
-#  name = "csit_ubuntu_noble_x86_sut-packer"
-#  sources = [
-#    "source.amazon-ebs.csit_ubuntu_noble_x86_sut"
-#  ]
-#  provisioner "shell" {
-#    inline = var.first_run_commands
-#  }
-#  provisioner "ansible" {
-#    playbook_file = var.ansible_file_path
-#    user          = "ubuntu"
-#    use_proxy     = false
-#    groups        = ["sut_aws"]
-#    extra_arguments = [
-#      "--extra-vars", "ansible_ssh_pass=${var.ansible_provision_pwd}",
-#      "--extra-vars", "aws=true"
-#    ]
-#  }
-#  provisioner "shell" {
-#    inline = var.last_run_commands
-#  }
-#}
+build {
+  name = "csit_ubuntu_noble_x86_sut-packer"
+  sources = [
+    "source.amazon-ebs.csit_ubuntu_noble_x86_sut"
+  ]
+  provisioner "shell" {
+    inline = var.first_run_commands
+  }
+  provisioner "ansible" {
+    playbook_file = var.ansible_file_path
+    user          = "ubuntu"
+    use_proxy     = false
+    groups        = ["sut_aws"]
+    extra_arguments = [
+      "--extra-vars", "ansible_ssh_pass=${var.ansible_provision_pwd}",
+      "--extra-vars", "aws=true"
+    ]
+  }
+  provisioner "shell" {
+    inline = var.last_run_commands_sut
+  }
+}
 
 build {
   name = "csit_ubuntu_noble_x86_tg-packer"
@@ -126,6 +135,6 @@ build {
     ]
   }
   provisioner "shell" {
-    inline = var.last_run_commands
+    inline = var.last_run_commands_tg
   }
 }