Commit 5d0c2216 by stu

update packer scripts to use ansible bootstrap script

parent bf898029
......@@ -3,7 +3,9 @@
"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 `HARPROFILER_BASE_AMI`}}"
"venv_dir": "/edx/app/edx_ansible/venvs/edx_ansible",
"ami": "{{env `HARPROFILER_BASE_AMI`}}",
"delete_or_keep": "{{env `DELETE_OR_KEEP_AMI`}}"
},
"builders": [{
"type": "amazon-ebs",
......@@ -13,30 +15,32 @@
"source_ami": "{{user `ami`}}",
"instance_type": "m1.small",
"ssh_username": "ubuntu",
"ami_name": "harprofiler-{{isotime | clean_ami_name}}"
"ami_name": "harprofiler-{{isotime | clean_ami_name}}",
"tags": {
"delete_or_keep": "{{user `delete_or_keep`}}"
}
}],
"provisioners": [{
"type": "shell",
"inline": ["rm -rf {{user `playbook_remote_dir`}}"]
"inline": ["rm -rf {{user `playbook_remote_dir`}}",
"mkdir {{user `playbook_remote_dir`}}"]
}, {
"type": "file",
"source": "../../playbooks",
"destination": "{{user `playbook_remote_dir`}}"
}, {
"type": "file",
"source": "../../requirements.txt",
"destination": "{{user `playbook_remote_dir`}}/requirements.txt"
}, {
"type": "file",
"source": "../../github.txt",
"destination": "{{user `playbook_remote_dir`}}/github.txt"
"source": "../../util/install/ansible-bootstrap.sh",
"destination": "{{user `playbook_remote_dir`}}/ansible-bootstrap.sh"
}, {
"type": "shell",
"inline": ["cd {{user `playbook_remote_dir`}}",
"virtualenv packer-venv",
". packer-venv/bin/activate",
"pip install -q -r requirements.txt",
"echo 'localhost' > inventory.ini",
"ansible-playbook run_role.yml -i inventory.ini -c local -e role=harprofiler -vvvv"]
"export CONFIGURATION_VERSION='{{user `remote_branch`}}'",
"sudo bash ./ansible-bootstrap.sh" ]
}, {
"type": "ansible-local",
"playbook_file": "../../playbooks/edx-east/harprofiler.yml",
"playbook_dir": "../../playbooks",
"command": ". {{user `venv_dir`}}/bin/activate && ansible-playbook",
"inventory_groups": "harprofiler_worker",
"extra_arguments": [
"-vvv"
]
}]
}
......@@ -3,9 +3,11 @@
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_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`}}",
"delete_or_keep": "{{env `DELETE_OR_KEEP_AMI`}}"
"delete_or_keep": "{{env `DELETE_OR_KEEP_AMI`}}",
"remote_branch": "{{env `REMOTE_BRANCH`}}"
},
"builders": [{
"type": "amazon-ebs",
......@@ -28,65 +30,29 @@
"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": "file",
"source": "../../github.txt",
"destination": "{{user `playbook_remote_dir`}}/github.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"]
"source": "../../util/install/ansible-bootstrap.sh",
"destination": "{{user `playbook_remote_dir`}}/ansible-bootstrap.sh"
}, {
"type": "shell",
"inline": ["cd {{user `playbook_remote_dir`}}",
"virtualenv packer-venv",
". packer-venv/bin/activate",
"pip install -q -r requirements.txt"]
"export CONFIGURATION_VERSION='{{user `remote_branch`}}'",
"sudo bash ./ansible-bootstrap.sh" ]
}, {
"type": "ansible-local",
"playbook_file": "../../playbooks/edx-east/jenkins_worker.yml",
"playbook_dir": "../../playbooks",
"command": "source {{user `playbook_remote_dir`}}/packer-venv/bin/activate && ansible-playbook",
"command": ". {{user `venv_dir`}}/bin/activate && ansible-playbook",
"inventory_groups": "jenkins_worker",
"extra_arguments": [
"-e \"jenkins_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"]
}, {
"type": "ansible-local",
"playbook_file": "../../playbooks/run_role.yml",
"playbook_dir": "../../playbooks",
"command": "source {{user `playbook_remote_dir`}}/packer-venv/bin/activate && ansible-playbook",
"command": ". {{user `venv_dir`}}/bin/activate && ansible-playbook",
"inventory_groups": "jenkins_worker",
"extra_arguments": [
"-e \"role=test_build_server test_edx_platform_version={{user `test_platform_version`}}\"",
......
......@@ -3,6 +3,7 @@
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"playbook_remote_dir": "/tmp/packer-edx-playbooks",
"venv_dir": "/edx/app/edx_ansible/venvs/edx_ansible",
"ami": "{{env `JENKINS_WORKER_AMI`}}",
"delete_or_keep": "{{env `DELETE_OR_KEEP_AMI`}}",
"remote_branch": "{{env `REMOTE_BRANCH`}}"
......@@ -29,18 +30,6 @@
"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": "../../util/install/ansible-bootstrap.sh",
"destination": "{{user `playbook_remote_dir`}}/ansible-bootstrap.sh"
}, {
......@@ -52,7 +41,7 @@
"type": "ansible-local",
"playbook_file": "../../playbooks/edx-east/jenkins_worker_android.yml",
"playbook_dir": "../../playbooks",
"command": "source /edx/app/edx_ansible/venvs/edx_ansible/bin/activate && ansible-playbook",
"command": ". {{user `venv_dir`}}/bin/activate && ansible-playbook",
"inventory_groups": "jenkins_worker",
"extra_arguments": [ "-vvv" ]
}]
......
......@@ -3,8 +3,11 @@
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_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`}}"
"test_platform_version": "{{env `TEST_PLATFORM_VERSION`}}",
"delete_or_keep": "{{env `DELETE_OR_KEEP_AMI`}}",
"remote_branch": "{{env `REMOTE_BRANCH`}}"
},
"builders": [{
"type": "amazon-ebs",
......@@ -17,58 +20,32 @@
"ssh_username": "ubuntu",
"ami_description": "jenkins worker",
"iam_instance_profile": "jenkins-worker",
"security_group_id": "sg-75af5e18"
"security_group_id": "sg-75af5e18",
"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": "../../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": "file",
"source": "../../github.txt",
"destination": "{{user `playbook_remote_dir`}}/github.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"]
"source": "../../util/install/ansible-bootstrap.sh",
"destination": "{{user `playbook_remote_dir`}}/ansible-bootstrap.sh"
}, {
"type": "shell",
"inline": ["cd {{user `playbook_remote_dir`}}",
"virtualenv packer-venv",
". packer-venv/bin/activate",
"pip install -q -r requirements.txt"]
"export CONFIGURATION_VERSION='{{user `remote_branch`}}'",
"sudo bash ./ansible-bootstrap.sh" ]
}, {
"type": "ansible-local",
"playbook_file": "../../playbooks/edx-east/jenkins_worker.yml",
"playbook_dir": "../../playbooks",
"command": "source {{user `playbook_remote_dir`}}/packer-venv/bin/activate && ansible-playbook",
"command": ". {{user `venv_dir`}}/bin/activate && ansible-playbook",
"inventory_groups": "jenkins_worker",
"extra_arguments": [
"-vvv"
]
]
}]
}
......@@ -3,7 +3,10 @@
"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`}}"
"venv_dir": "/edx/app/edx_ansible/venvs/edx_ansible",
"ami": "{{env `JENKINS_WORKER_AMI`}}",
"delete_or_keep": "{{env `DELETE_OR_KEEP_AMI`}}",
"remote_branch": "{{env `REMOTE_BRANCH`}}"
},
"builders": [{
"type": "amazon-ebs",
......@@ -16,49 +19,32 @@
"ssh_username": "ubuntu",
"ami_description": "jenkins worker sitespeedio",
"iam_instance_profile": "jenkins-worker",
"security_group_id": "sg-75af5e18"
"security_group_id": "sg-75af5e18",
"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": "../../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": "file",
"source": "../../github.txt",
"destination": "{{user `playbook_remote_dir`}}/github.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"]
"source": "../../util/install/ansible-bootstrap.sh",
"destination": "{{user `playbook_remote_dir`}}/ansible-bootstrap.sh"
}, {
"type": "shell",
"inline": ["cd {{user `playbook_remote_dir`}}",
"virtualenv packer-venv",
". packer-venv/bin/activate",
"pip install -q -r requirements.txt",
"echo '[jenkins_worker]' > inventory.ini",
"echo 'localhost' >> inventory.ini",
"ansible-playbook edx-east/jenkins_worker_sitespeedio.yml -i inventory.ini -c local -vvvv"]
"export CONFIGURATION_VERSION='{{user `remote_branch`}}'",
"sudo bash ./ansible-bootstrap.sh" ]
}, {
"type": "ansible-local",
"playbook_file": "../../playbooks/edx-east/jenkins_worker_sitespeedio.yml",
"playbook": "../../playbooks",
"command": ". {{user `venv_dir`}}/bin/activate && ansible-playbook",
"inventory_groups": "jenkins workers",
"extra_arguments": [
"-vvv"
]
}]
}
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