jenkins_worker_simple.json 2.11 KB
Newer Older
1 2 3 4
{
  "variables": {
    "aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
    "aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
5
    "new_relic_key": "{{env `NEW_RELIC_KEY`}}",
6
    "playbook_remote_dir": "/tmp/packer-edx-playbooks",
7
    "venv_dir": "/edx/app/edx_ansible/venvs/edx_ansible",
Ben Patterson committed
8
    "ami": "{{env `JENKINS_WORKER_AMI`}}",
9
    "test_platform_version": "{{env `TEST_PLATFORM_VERSION`}}",
10
    "security_group": "{{env `AWS_SECURITY_GROUP`}}",
11 12
    "delete_or_keep": "{{env `DELETE_OR_KEEP_AMI`}}",
    "remote_branch": "{{env `REMOTE_BRANCH`}}"
13 14 15 16 17 18 19 20 21 22 23 24
  },
  "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",
25
    "security_group_id": "{{user `security_group`}}",
26 27 28
    "tags": {
        "delete_or_keep": "{{user `delete_or_keep`}}"
    }
29 30 31 32 33 34 35
  }],
  "provisioners": [{
    "type": "shell",
    "inline": ["rm -rf {{user `playbook_remote_dir`}}",
      "mkdir {{user `playbook_remote_dir`}}"]
  }, {
    "type": "file",
36 37 38 39
    "source": "stop-automatic-updates.sh",
    "destination": "{{user `playbook_remote_dir`}}/stop-automatic-updates.sh"
  }, {
    "type": "file",
40 41
    "source": "../../util/install/ansible-bootstrap.sh",
    "destination": "{{user `playbook_remote_dir`}}/ansible-bootstrap.sh"
Ben Patterson committed
42 43
  }, {
    "type": "shell",
44
    "inline": ["cd {{user `playbook_remote_dir`}}",
45
      "export CONFIGURATION_VERSION='{{user `remote_branch`}}'",
46
      "sudo bash ./stop-automatic-updates.sh",
47
      "sudo bash ./ansible-bootstrap.sh" ]
Ben Patterson committed
48 49 50 51
  }, {
    "type": "ansible-local",
    "playbook_file": "../../playbooks/edx-east/jenkins_worker.yml",
    "playbook_dir": "../../playbooks",
52
    "command": ". {{user `venv_dir`}}/bin/activate && ansible-playbook",
Ben Patterson committed
53 54
    "inventory_groups": "jenkins_worker",
    "extra_arguments": [
55
      "-e \"NEWRELIC_LICENSE_KEY={{user `new_relic_key`}}\"",
Ben Patterson committed
56
      "-vvv"
57
    ]
58 59
  }]
}