forked from iradaik/snapdirector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapdirector_ami.json
74 lines (72 loc) · 2.33 KB
/
snapdirector_ami.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [ {
"name": "snapdirAmazonLinux",
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami": "ami-60b6c60a",
"instance_type": "t2.micro",
"ssh_username": "ec2-user",
"ssh_pty": true,
"ami_name": "SungardAS-AMI-Amazon-Linux-x86_64-HVM-Enhanced-Snapshots-2016.03.29",
"tags": {
"Name": "Enhanced Snapshots",
"Description": "Backup, recovery, disaster recovery, snapshot, schedule"
}
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo {{user `ssh_username`}} | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"inline": [
"yum -y update",
"yum -y install python-boto",
"yum -y install epel-release",
"yum-config-manager --enable epel",
"easy_install pip",
"pip install ansible"
]
},
{
"type": "ansible-local",
"playbook_file": "ansible/ec2-playbook.yml",
"inventory_file": "ansible/inventory",
"role_paths": [
"ansible/roles/maven",
"ansible/roles/nodejs",
"ansible/roles/opendedup",
"ansible/roles/openjdk",
"ansible/roles/oracle-java8",
"ansible/roles/tomcat8",
"ansible/roles/nginx",
"ansible/roles/awslogs",
"ansible/roles/logrotate"
]
},
{
"type": "shell",
"inline": [
"echo 'Starting deployment process...'",
"sudo curl -O https://s3.amazonaws.com/com.sungardas.test/enhancedsnapshots_latest.war",
"sudo service tomcat8 stop",
"sudo rm -rf /opt/tomcat-latest/webapps/*",
"sudo cp enhancedsnapshots_latest.war /opt/tomcat-latest/webapps/ROOT.war",
"sudo service tomcat8 start",
"sudo pip uninstall -y ansible",
"sudo yum-config-manager --disable epel",
"sudo yum -y remove epel-release",
"sudo yum -y remove python-boto",
"rm -rf snapdirector.war",
"sudo rm -rf /tmp/packer-provisioner-ansible-local",
"sudo find / -name authorized_keys | sudo xargs rm -rf",
"history -c"
]
}
]
}