{ "variables": { "aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}", "aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}", "new_relic_key": "{{env `NEW_RELIC_KEY`}}", "playbook_remote_dir": "/tmp/packer-edx-playbooks", "venv_dir": "/edx/app/edx_ansible/venvs/edx_ansible", "ami": "{{env `JENKINS_WORKER_AMI`}}", "test_platform_version": "{{env `TEST_PLATFORM_VERSION`}}", "security_group": "{{env `AWS_SECURITY_GROUP`}}", "delete_or_keep": "{{env `DELETE_OR_KEEP_AMI`}}", "remote_branch": "{{env `REMOTE_BRANCH`}}" }, "builders": [{ "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "ami_name": "jenkins_worker-{{isotime | clean_ami_name}}", "instance_type": "m3.large", "region": "us-east-1", "source_ami": "{{user `ami`}}", "ssh_username": "ubuntu", "ami_description": "jenkins worker", "iam_instance_profile": "jenkins-worker", "security_group_id": "{{user `security_group`}}", "tags": { "delete_or_keep": "{{user `delete_or_keep`}}" } }], "provisioners": [{ "type": "shell", "inline": ["rm -rf {{user `playbook_remote_dir`}}", "mkdir {{user `playbook_remote_dir`}}"] }, { "type": "file", "source": "stop-automatic-updates.sh", "destination": "{{user `playbook_remote_dir`}}/stop-automatic-updates.sh" }, { "type": "file", "source": "../../util/install/ansible-bootstrap.sh", "destination": "{{user `playbook_remote_dir`}}/ansible-bootstrap.sh" }, { "type": "shell", "inline": ["cd {{user `playbook_remote_dir`}}", "export CONFIGURATION_VERSION='{{user `remote_branch`}}'", "sudo bash ./stop-automatic-updates.sh", "sudo bash ./ansible-bootstrap.sh" ] }, { "type": "ansible-local", "playbook_file": "../../playbooks/edx-east/jenkins_worker.yml", "playbook_dir": "../../playbooks", "command": ". {{user `venv_dir`}}/bin/activate && ansible-playbook", "inventory_groups": "jenkins_worker", "extra_arguments": [ "-e \"NEWRELIC_LICENSE_KEY={{user `new_relic_key`}}\"", "-vvv" ] }] }