commit b067360037c85ce8208d145a576e38e032d97b61 Author: Ryan Malloy Date: Tue Nov 12 18:10:46 2024 +0000 Add manager-ami.pkr.hcl diff --git a/manager-ami.pkr.hcl b/manager-ami.pkr.hcl new file mode 100644 index 0000000..1575d8d --- /dev/null +++ b/manager-ami.pkr.hcl @@ -0,0 +1,63 @@ +packer { + required_plugins { + amazon = { + version = ">= 1.2.8" + source = "github.com/hashicorp/amazon" + } + } +} + +variable "AWSAccessKeyID" {} +variable "AWSSecretAccessKey" {} + +source "amazon-ebs" "ubuntu" { + ami_name = "gitlab-runner-manager-packer-ami" + instance_type = "t2.nano" + region = + source_ami_filter { + filters = { + name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*" + root-device-type = "ebs" + virtualization-type = "hvm" + } + most_recent = true + owners = ["099720109477"] + } + ssh_username = "ubuntu" +} + +build { + name = "runner-manager-ami-packer" + sources = [ + "source.amazon-ebs.ubuntu" + ] + + provisioner "file" { + source = "privateKey.pem" + destination = "~/.ssh/key.pem" + } + provisioner "shell" { + inline = [ + "chmod 400 ~/.ssh/key.pem" + ] + } + + provisioner "shell" { + script = "install-docker.sh" + } + + provisioner "shell" { + inline = [ + "mkdir ~/.aws" + ] + } + provisioner "file" { + source = "aws-config" + destination = "~/.aws/config" + } + provisioner "file" { + source = "aws-creds" + destination = "~/.aws/credentials" + } + +} \ No newline at end of file