Guest User

Untitled

a guest
Mar 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. AWSTemplateFormatVersion: '2010-09-09'
  2. Metadata: {}
  3.  
  4. Parameters:
  5. ###########
  6. KeyName:
  7. Description: The EC2 Key Pair to allow SSH access to the instance
  8. Type: 'AWS::EC2::KeyPair::KeyName'
  9. AvailabilityZone:
  10. Description: Availability zone to deploy
  11. Type: AWS::EC2::AvailabilityZone::Name
  12.  
  13. Mappings:
  14. #########
  15. RegionMap:
  16. us-east-1:
  17. CentOS7: "ami-ae7bfdb8"
  18. us-east-2:
  19. CentOS7: "ami-9cbf9bf9"
  20. us-west-1:
  21. CentOS7: "ami-65e0e305"
  22.  
  23. Resources:
  24. ##########
  25. openshiftvpc:
  26. Type: "AWS::EC2::VPC"
  27. Properties:
  28. CidrBlock: 10.0.0.0/28
  29. EnableDnsSupport: true
  30. EnableDnsHostnames: true
  31. Tags:
  32. - Key: Name
  33. Value: openshift-cf-vpc
  34.  
  35. internetgatewayos:
  36. Type: AWS::EC2::InternetGateway
  37.  
  38. gatewayattachment:
  39. Type: AWS::EC2::VPCGatewayAttachment
  40. Properties:
  41. InternetGatewayId: !Ref internetgatewayos
  42. VpcId: !Ref openshiftvpc
  43.  
  44. subnet:
  45. Type: 'AWS::EC2::Subnet'
  46. Properties:
  47. VpcId: !Ref openshiftvpc
  48. CidrBlock: 10.0.0.0/28
  49. AvailabilityZone: !Ref AvailabilityZone
  50.  
  51. routetable:
  52. Type: 'AWS::EC2::RouteTable'
  53. Properties:
  54. VpcId: !Ref openshiftvpc
  55.  
  56. subnetroutetableasoc:
  57. Type: "AWS::EC2::SubnetRouteTableAssociation"
  58. Properties:
  59. RouteTableId: !Ref routetable
  60. SubnetId: !Ref subnet
  61.  
  62. route:
  63. Type: "AWS::EC2::Route"
  64. Properties:
  65. RouteTableId: !Ref routetable
  66. DestinationCidrBlock: 0.0.0.0/0
  67. GatewayId: !Ref internetgatewayos
  68.  
  69. openshiftmaster:
  70. Type: 'AWS::EC2::Instance'
  71. Properties:
  72. Tags:
  73. - Key: Name
  74. Value: openshift-master
  75. InstanceType: t2.medium
  76. KeyName: !Ref KeyName
  77. AvailabilityZone: !Ref AvailabilityZone
  78. NetworkInterfaces:
  79. - AssociatePublicIpAddress: "true"
  80. DeviceIndex: "0"
  81. SubnetId: !Ref subnet
  82. GroupSet:
  83. - !Ref mastersecgroup
  84. ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", CentOS7]
  85.  
  86. openshiftworker1:
  87. Type: 'AWS::EC2::Instance'
  88. Properties:
  89. Tags:
  90. - Key: Name
  91. Value: openshift-worker1
  92. InstanceType: t2.medium
  93. KeyName: !Ref KeyName
  94. AvailabilityZone: !Ref AvailabilityZone
  95. NetworkInterfaces:
  96. - AssociatePublicIpAddress: "true"
  97. DeviceIndex: "0"
  98. SubnetId: !Ref subnet
  99. GroupSet:
  100. - !Ref workersecgroup
  101. ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", CentOS7]
  102.  
  103. openshiftworker2:
  104. Type: 'AWS::EC2::Instance'
  105. Properties:
  106. Tags:
  107. - Key: Name
  108. Value: openshift-worker2
  109. InstanceType: t2.medium
  110. KeyName: !Ref KeyName
  111. AvailabilityZone: !Ref AvailabilityZone
  112. NetworkInterfaces:
  113. - AssociatePublicIpAddress: "true"
  114. DeviceIndex: "0"
  115. SubnetId: !Ref subnet
  116. GroupSet:
  117. - !Ref workersecgroup
  118. ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", CentOS7]
  119.  
  120. volume1:
  121. Type: 'AWS::EC2::Volume'
  122. Properties:
  123. AvailabilityZone: !GetAtt openshiftmaster.AvailabilityZone
  124. Size: 50
  125. DeletionPolicy: Delete
  126.  
  127. volat1:
  128. Type: AWS::EC2::VolumeAttachment
  129. Properties:
  130. Device: '/dev/xvdb'
  131. VolumeId: !Ref volume1
  132. InstanceId: !Ref openshiftmaster
  133.  
  134. volume2:
  135. Type: 'AWS::EC2::Volume'
  136. Properties:
  137. AvailabilityZone: !GetAtt openshiftworker1.AvailabilityZone
  138. Size: 50
  139. DeletionPolicy: Delete
  140.  
  141. volat2:
  142. Type: AWS::EC2::VolumeAttachment
  143. Properties:
  144. Device: '/dev/xvdb'
  145. VolumeId: !Ref volume2
  146. InstanceId: !Ref openshiftworker1
  147.  
  148. volume3:
  149. Type: 'AWS::EC2::Volume'
  150. Properties:
  151. AvailabilityZone: !GetAtt openshiftworker2.AvailabilityZone
  152. Size: 50
  153. DeletionPolicy: Delete
  154.  
  155. volat3:
  156. Type: AWS::EC2::VolumeAttachment
  157. Properties:
  158. Device: '/dev/xvdb'
  159. VolumeId: !Ref volume3
  160. InstanceId: !Ref openshiftworker2
  161.  
  162. workersecgroup:
  163. Type: AWS::EC2::SecurityGroup
  164. Properties:
  165. VpcId: !Ref openshiftvpc
  166. GroupDescription: Security group for the worker Kubernetes nodes
  167. SecurityGroupIngress:
  168. - IpProtocol: -1
  169. FromPort: -1
  170. ToPort: -1
  171. CidrIp: 10.0.0.0/28
  172. - IpProtocol: tcp
  173. FromPort: '22'
  174. ToPort: '22'
  175. CidrIp: 0.0.0.0/0
  176.  
  177. mastersecgroup:
  178. Type: AWS::EC2::SecurityGroup
  179. Properties:
  180. VpcId: !Ref openshiftvpc
  181. GroupDescription: Security group for the master Kubernetes node
  182. SecurityGroupIngress:
  183. - IpProtocol: -1
  184. FromPort: -1
  185. ToPort: -1
  186. CidrIp: 10.0.0.0/28
  187. - IpProtocol: tcp
  188. FromPort: '22'
  189. ToPort: '22'
  190. CidrIp: 0.0.0.0/0
  191. - IpProtocol: tcp
  192. FromPort: '8443'
  193. ToPort: '8443'
  194. CidrIp: 0.0.0.0/0
  195. - IpProtocol: tcp
  196. FromPort: '10250'
  197. ToPort: '10250'
  198. CidrIp: 0.0.0.0/0
Add Comment
Please, Sign In to add comment