--- /dev/null
+{
+ "description": "Build an AMI for use as a CI builder",
+ "variables": {
+ "ansible_roles_path": ".galaxy",
+ "aws_access_key": null,
+ "aws_secret_key": null,
+ "security_group_id": null,
+ "source_ami_filter_name": null,
+ "source_ami_filter_owner": null,
+ "aws_instance_type": "t2.micro",
+ "aws_region": "us-west-2",
+ "vpc_id": null,
+ "subnet_id": null,
+ "ssh_user": null,
+ "distro": null,
+ "cloud_user_data": null,
+ "ssh_proxy_host": ""
+ },
+ "builders": [
+ {
+ "name": "aws",
+ "access_key": "{{user `aws_access_key`}}",
+ "ami_name": "ZZCI - {{user `distro`}} - builder-aws - {{isotime \"20060102-1504\"}}",
+ "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`}}",
+ "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-builder.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"
+ ]
+ }
+ ]
+}