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
]
}
-variable "last_run_commands" {
+variable "last_run_commands_sut" {
description = "Commands to run after deployment via remote-exec"
type = list(string)
default = [
]
}
+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
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
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
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"
]
}
provisioner "shell" {
- inline = var.last_run_commands
+ inline = var.last_run_commands_tg
}
}