Commit 1112796f by Ben Patterson

wip using ansible provisioner.

parent dfa9ce1b
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"playbook_remote_dir": "/tmp/packer-edx-playbooks",
"ami": "{{env `JENKINS_WORKER_AMI`}}",
"test_platform_version": "{{env `TEST_PLATFORM_VERSION`}}"
},
"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": "sg-75af5e18"
}],
"provisioners": [{
"type": "shell",
"inline": ["rm -rf {{user `playbook_remote_dir`}}",
"mkdir {{user `playbook_remote_dir`}}"]
}, {
"type": "file",
"source": "../../playbooks/run_role.yml",
"destination": "{{user `playbook_remote_dir`}}/run_role.yml"
}, {
"type": "file",
"source": "../../playbooks/roles",
"destination": "{{user `playbook_remote_dir`}}/roles"
}, {
"type": "file",
"source": "../../playbooks/edx-east",
"destination": "{{user `playbook_remote_dir`}}/edx-east"
}, {
"type": "file",
"source": "../../requirements.txt",
"destination": "{{user `playbook_remote_dir`}}/requirements.txt"
}, {
"type": "shell",
"inline": ["sudo add-apt-repository ppa:git-core/ppa -y"]
}, {
"type": "shell",
"inline": ["sudo apt-get update"]
}, {
"type": "shell",
"inline": ["sudo apt-get -y install git-core"]
}, {
"type": "shell",
"inline": ["sudo apt-get -y install libmysqlclient-dev"]
}, {
"type": "shell",
"inline": ["cd {{user `playbook_remote_dir`}}",
"virtualenv packer-venv",
". packer-venv/bin/activate",
"pip install -q -r requirements.txt"]
}, {
"type": "ansible-local",
"playbook_file": "../../playbooks/run_role.yml",
"playbook_dir": "../../playbooks",
"command": "source {{user `playbook_remote_dir`}}/packer-venv/bin/activate && ansible-playbook",
"inventory_groups": "jenkins_worker",
"extra_arguments": [
"-e \"role=test_build_server test_edx_platform_version={{user `test_platform_version`}}\"",
"-vvv"
]
}, {
"type": "shell",
"inline": ["cd {{user `playbook_remote_dir`}}",
"rm -rf packer-venv",
"virtualenv packer-venv",
". packer-venv/bin/activate",
"pip install -q -r requirements.txt",
"ansible-playbook run_role.yml -i inventory.ini -c local -e role=test_build_server -vvvv"]
}]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment