diff options
author | pmikus <pmikus@cisco.com> | 2021-10-19 08:40:25 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2021-10-19 09:11:06 +0000 |
commit | 8f6c947912621fe8b8c870959e8025f0f3de5101 (patch) | |
tree | ef3015cf994ed9f60ddd58c046e1d4c85a7c44a6 | |
parent | 023ce436b2e651b697cd54005fb9c32e4b69e8c0 (diff) |
fix(Packer): AWS images bugs
Signed-off-by: pmikus <pmikus@cisco.com>
Change-Id: I5bd759a71abf965374b2a6c8951eda75232fc9aa
-rw-r--r-- | fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl | 114 | ||||
-rw-r--r-- | fdio.infra.packer/aws_c5n/ubuntu_focal.pkr.hcl (renamed from fdio.infra.packer/2n_aws_c5n/ubuntu_focal.pkr.hcl) | 20 | ||||
-rw-r--r-- | fdio.infra.terraform/2n_aws_c5n/variables.tf | 4 | ||||
-rw-r--r-- | fdio.infra.terraform/3n_aws_c5n/variables.tf | 4 |
4 files changed, 21 insertions, 121 deletions
diff --git a/fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl b/fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl deleted file mode 100644 index 0fc3f36907..0000000000 --- a/fdio.infra.packer/3n_aws_c5n/ubuntu_focal.pkr.hcl +++ /dev/null @@ -1,114 +0,0 @@ -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/2n_aws_c5n/ubuntu_focal.pkr.hcl b/fdio.infra.packer/aws_c5n/ubuntu_focal.pkr.hcl index 0fc3f36907..4a09160261 100644 --- a/fdio.infra.packer/2n_aws_c5n/ubuntu_focal.pkr.hcl +++ b/fdio.infra.packer/aws_c5n/ubuntu_focal.pkr.hcl @@ -8,13 +8,21 @@ packer { } variable "first_run_commands" { - description = "Commands to run after deployment via remote-exec" + 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 @@ -43,7 +51,7 @@ 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" + instance_type = "c5n.4xlarge" launch_block_device_mappings { device_name = "/dev/sda1" volume_size = 40 @@ -60,7 +68,7 @@ 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" + instance_type = "c5n.4xlarge" launch_block_device_mappings { device_name = "/dev/sda1" volume_size = 40 @@ -91,6 +99,9 @@ build { "--extra-vars", "aws=true" ] } + provisioner "shell" { + inline = var.last_run_commands + } } build { @@ -111,4 +122,7 @@ build { "--extra-vars", "aws=true" ] } + provisioner "shell" { + inline = var.last_run_commands + } } diff --git a/fdio.infra.terraform/2n_aws_c5n/variables.tf b/fdio.infra.terraform/2n_aws_c5n/variables.tf index 62a7de4c57..93e4d29a89 100644 --- a/fdio.infra.terraform/2n_aws_c5n/variables.tf +++ b/fdio.infra.terraform/2n_aws_c5n/variables.tf @@ -19,7 +19,7 @@ variable "ami_image_tg" { # kernel 5.4.0-1035-aws (~5.4.0-65) description = "AWS AMI image ID" type = string - default = "ami-0d6bc0344dc036b9d" + default = "ami-038ede035b200bf55" } variable "ami_image_sut" { @@ -27,7 +27,7 @@ variable "ami_image_sut" { # kernel 5.4.0-1035-aws (~5.4.0-65) description = "AWS AMI image ID" type = string - default = "ami-012c9c631964367be" + default = "ami-08675923394f0c300" } variable "instance_initiated_shutdown_behavior" { diff --git a/fdio.infra.terraform/3n_aws_c5n/variables.tf b/fdio.infra.terraform/3n_aws_c5n/variables.tf index 129d5dc785..80f2829f22 100644 --- a/fdio.infra.terraform/3n_aws_c5n/variables.tf +++ b/fdio.infra.terraform/3n_aws_c5n/variables.tf @@ -19,7 +19,7 @@ variable "ami_image_tg" { # kernel 5.4.0-1035-aws (~5.4.0-65) description = "AWS AMI image ID" type = string - default = "ami-0d6bc0344dc036b9d" + default = "ami-038ede035b200bf55" } variable "ami_image_sut" { @@ -27,7 +27,7 @@ variable "ami_image_sut" { # kernel 5.4.0-1035-aws (~5.4.0-65) description = "AWS AMI image ID" type = string - default = "ami-012c9c631964367be" + default = "ami-08675923394f0c300" } variable "instance_initiated_shutdown_behavior" { |