-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathansiblebase.template
91 lines (91 loc) · 3 KB
/
ansiblebase.template
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
"Description": "Effective DevOps in AWS: HelloWorld web application",
"Outputs": {
"InstancePublicIp": {
"Description": "Public IP of our instance.",
"Value": {
"Fn::GetAtt": [
"instance",
"PublicIp"
]
}
},
"WebUrl": {
"Description": "Application endpoint",
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"instance",
"PublicDnsName"
]
},
":",
"3000"
]
]
}
}
},
"Parameters": {
"KeyPair": {
"ConstraintDescription": "must be the name of an existing EC2 KeyPair.",
"Description": "Name of an existing EC2 KeyPair to SSH",
"Type": "AWS::EC2::KeyPair::KeyName"
}
},
"Resources": {
"SecurityGroup": {
"Properties": {
"GroupDescription": "Allow SSH and TCP/3000 access",
"SecurityGroupIngress": [
{
"CidrIp": "0.0.0.0/0",
"FromPort": "22",
"IpProtocol": "tcp",
"ToPort": "22"
},
{
"CidrIp": "0.0.0.0/0",
"FromPort": "3000",
"IpProtocol": "tcp",
"ToPort": "3000"
}
]
},
"Type": "AWS::EC2::SecurityGroup"
},
"instance": {
"Properties": {
"ImageId": "ami-0ff8a91507f77f867",
"InstanceType": "t2.micro",
"KeyName": {
"Ref": "KeyPair"
},
"SecurityGroups": [
{
"Ref": "SecurityGroup"
}
],
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"\n",
[
"#!/bin/bash",
"yum install --enablerepo=epel -y git",
"pip install ansible",
"/usr/local/bin/ansible-pull -U https://github.com/CelestialMusa/Ansible helloworld.yml localhost",
"echo '*/10 **** /usr/local/bin/ansible-pull -U https://github.com/CelestialMusa/Ansible helloworld.yml localhost' > /etc/cron.d/ansible-pull"
]
]
}
}
},
"Type": "AWS::EC2::Instance"
}
}
}