From 2b4b0c7f0bbc01a432c59e62f5fdc3e723faf644 Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Tue, 20 Apr 2021 11:38:27 -0700 Subject: [PATCH] Add docker-aws template We now have at least one project on AWS that needs a docker template. Issue: IT-21917 Change-Id: Ia08a1a32eb2ffaab46b1f01468018de688423852 Signed-off-by: Eric Ball --- templates/docker-aws.json | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 templates/docker-aws.json diff --git a/templates/docker-aws.json b/templates/docker-aws.json new file mode 100644 index 0000000..831605d --- /dev/null +++ b/templates/docker-aws.json @@ -0,0 +1,72 @@ +{ + "description": "Build an AMI for use as a CI builder", + "variables": { + "ansible_roles_path": ".galaxy", + "arch": "x86_64", + "aws_instance_type": "t2.micro", + "aws_region": "us-west-2", + "aws_access_key": null, + "aws_secret_key": null, + "cloud_user_data": null, + "distro": null, + "security_group_id": null, + "source_ami_filter_name": null, + "source_ami_filter_owner": null, + "source_ami_filter_product_code": null, + "subnet_id": null, + "ssh_user": null, + "ssh_proxy_host": "", + "vpc_id": null + }, + "builders": [ + { + "name": "aws", + "access_key": "{{user `aws_access_key`}}", + "ami_name": "ZZCI - {{user `distro`}} - docker-aws - {{user `arch`}} - {{isotime \"20060102-150405.000\"}}", + "instance_type": "{{user `aws_instance_type`}}", + "region": "{{user `aws_region`}}", + "secret_key": "{{user `aws_secret_key`}}", + "security_group_id": "{{user `security_group_id`}}", + "source_ami_filter": { + "filters": { + "name": "{{user `source_ami_filter_name`}}", + "product-code": "{{user `source_ami_filter_product_code`}}", + "root-device-type": "ebs", + "virtualization-type": "hvm" + }, + "most_recent": true, + "owners": ["{{user `source_ami_filter_owner`}}"] + }, + "ssh_username": "{{user `ssh_user`}}", + "ssh_proxy_host": "{{user `ssh_proxy_host`}}", + "vpc_id": "{{user `vpc_id`}}", + "subnet_id": "{{user `subnet_id`}}", + "type": "amazon-ebs", + "user_data_file": "{{user `cloud_user_data`}}" + } + ], + "provisioners": [ + { + "type": "shell", + "scripts": ["common-packer/provision/install-python.sh"], + "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi" + }, + { + "type": "shell-local", + "command": "./common-packer/ansible-galaxy.sh {{user `ansible_roles_path`}}" + }, + { + "type": "ansible", + "user": "{{user `ssh_user`}}", + "playbook_file": "provision/local-docker.yaml", + "ansible_env_vars": [ + "ANSIBLE_NOCOWS=1", + "ANSIBLE_PIPELINING=False", + "ANSIBLE_HOST_KEY_CHECKING=False", + "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}", + "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", + "ANSIBLE_STDOUT_CALLBACK=debug" + ] + } + ] +} -- 2.16.6