aws-must 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -20
  3. data/demo/0/root.mustache +13 -1
  4. data/demo/2/conf.yaml +1 -5
  5. data/demo/{8 → 2}/resources.mustache +6 -15
  6. data/demo/2/root.mustache +13 -54
  7. data/demo/2.old/conf.yaml +5 -0
  8. data/demo/2.old/root.mustache +85 -0
  9. data/demo/3/conf.yaml +18 -2
  10. data/demo/3/resource.mustache +27 -0
  11. data/demo/3/resourceInstance.mustache +32 -0
  12. data/demo/3/resources.mustache +9 -8
  13. data/demo/3/root.mustache +17 -17
  14. data/demo/4/conf.yaml +19 -14
  15. data/demo/{8 → 4}/output.mustache +1 -2
  16. data/demo/4/resource.mustache +1 -1
  17. data/demo/4/resourceInstance.mustache +10 -5
  18. data/demo/4/resourceSecurityGroup.mustache +37 -0
  19. data/demo/4/root.mustache +16 -9
  20. data/demo/5/conf.yaml +3 -4
  21. data/demo/{8 → 5}/mappings.mustache +0 -0
  22. data/demo/5/output.mustache +2 -1
  23. data/demo/5/resource.mustache +3 -0
  24. data/demo/5/resourceInstance.mustache +4 -4
  25. data/demo/5/resources.mustache +12 -2
  26. data/demo/5/root.mustache +42 -9
  27. data/demo/6/conf.yaml +27 -8
  28. data/demo/{8 → 6}/parameter.mustache +0 -0
  29. data/demo/6/resource.mustache +10 -1
  30. data/demo/6/resourceInstance.mustache +13 -3
  31. data/demo/{8 → 6}/resourceSecurityGroup.mustache +0 -0
  32. data/demo/6/root.mustache +48 -15
  33. data/demo/{8 → 6}/tag.mustache +0 -0
  34. data/demo/7/conf.yaml +8 -3
  35. data/demo/7/resourceInstance.mustache +5 -2
  36. data/demo/{8 → 7}/resourceInstanceChef.mustache +0 -0
  37. data/demo/7/root.mustache +11 -3
  38. data/lib/tasks/demo.rake +6 -7
  39. metadata +14 -13
  40. data/demo/8/conf.yaml +0 -61
  41. data/demo/8/resource.mustache +0 -38
  42. data/demo/8/resourceInstance.mustache +0 -50
  43. data/demo/8/root.mustache +0 -191
@@ -13,6 +13,7 @@ Create an EC2 instance
13
13
  * `Name`: name of the EC2 instance to create
14
14
  * `InstanceType` : The instance type, such as t2.micro.
15
15
  * `tags` : array of tag sub-documents for EC2 instance
16
+ * `InstallChef`: add UserData to install Chef
16
17
 
17
18
 
18
19
  **Actions**:
@@ -23,9 +24,10 @@ Create an EC2 instance
23
24
  * **SecurityGroups.Ref**: `SecurityGroup` if `SecurityGroup`
24
25
  * **ImageId**: **AWSRegionArch2AMI**( 'AWS::Region', **AWSInstanceType2Arch**(`InstanceType`))
25
26
  * **KeyName**: `KeyName` if `KeyName`
27
+ * **include** <a href="#resourceInstanceChef.mustache">resourceInstanceChef.mustache</a> if `InstallChef`
26
28
 
27
29
  > tag
28
-
30
+ > resourceInstanceChef
29
31
 
30
32
  ++close++
31
33
 
@@ -41,5 +43,6 @@ Create an EC2 instance
41
43
  , "Tags" : [ {{#tags}}{{>tag}}{{/tags}} ]
42
44
  {{#SecurityGroup}}, "SecurityGroups" : [ { "Ref" : "{{SecurityGroup}}" } ]{{/SecurityGroup}}
43
45
  {{#KeyName}}, "KeyName" : { "Ref" : "{{KeyName}}" }{{/KeyName}}
44
- } {{! Propertites }}
46
+ {{#InstallChef }}, "UserData": { {{> resourceInstanceChef }} }{{/ InstallChef }}
47
+ }
45
48
  }{{_comma}}
File without changes
data/demo/7/root.mustache CHANGED
@@ -41,8 +41,9 @@ CONTENT section
41
41
 
42
42
  Creates
43
43
 
44
- * **EC2 SecurityGroup** allowing ssh via port 22 from a location given
45
- as `SSHLocation` parameter
44
+ * **EC2 SecurityGroup** allowing ssh via port 22 from a location
45
+ given as `SSHLocation` parameter
46
+
46
47
 
47
48
  * **EC2 instances** using YAML parameter `InstanceType`
48
49
  (e.g. t2.micro).
@@ -53,15 +54,19 @@ Creates
53
54
  eu-west-1, sa-east-1, us-east-1, us-gov-west-1, us-west-1,
54
55
  us-west-2.
55
56
 
57
+ * optionally installs Chef to the EC2 instance with a version given
58
+ as `ChefVersion` parameter
59
+
56
60
  * output section contains references to InstanceId and PublicId of
57
61
  the newly created EC2 instance.
58
62
 
59
-
60
63
  **Parameters**:
61
64
 
62
65
  * `InstanceType`: EC2 resource instance type, (default: t2.micro)
63
66
  * `KeyName` : Name of an existing EC2 KeyPair to enable SSH access to the instance, (default: demo-key)
64
67
  * `SSHLocation`: The IP address range that can be used to SSH to the EC2 instances default: 0.0.0.0/0)
68
+ * `ChefVersion`: Chef version to install, (default: 11.18)
69
+
65
70
 
66
71
  ## Document Content
67
72
 
@@ -113,6 +118,9 @@ href="#resourceInstance.mustache">resourceInstance.mustache</a>:
113
118
  create an EC2 instance</li>
114
119
 
115
120
  <ul><li><a href="#tag.mustache">tag.mustache</a>: add key-value tag property
121
+ to an</li>
122
+
123
+ <li><a href="#resourceInstanceChef.mustache">resourceInstanceChef.mustache</a>: UserData -script to install Chef
116
124
  to an</li><ul>
117
125
 
118
126
  </ul></ul></ul></ul>
data/lib/tasks/demo.rake CHANGED
@@ -22,13 +22,12 @@ namespace "demo" do |ns|
22
22
  [
23
23
 
24
24
  { :id => "1", :desc=>"Initial copy", :region=>['eu-central-1'], :ssh => false },
25
- { :id => "2", :desc=>"Added 'description' -property to YAML file", :region=>['eu-central-1'], :ssh => false },
26
- { :id => "3", :desc=>"Use resources.mustache -partial to create EC2 intance", :region=>['eu-central-1'], :ssh => false },
27
- { :id => "4", :desc=>"EC2 instance configuration using YAML-data", :region=>['eu-central-1'], :ssh => false },
28
- { :id => "5", :desc=>"Add 'Outputs' -section with reference to EC2 instance", :region=>['eu-central-1'], :ssh => false },
29
- { :id => "6", :desc=>"Add 'Inputs' and 'Mappings' -sections to parametirize", :region=> all_regions, :ssh => true },
30
- { :id => "7", :desc=>"Added support for input parameters, EC2 tags, Instance security group", :region=>all_regions, :ssh => true },
31
- { :id => "8", :desc=>"Added support for installing Chef", :region=>all_regions, :ssh => true },
25
+ { :id => "2", :desc=>"Added 'description' property, Use resources.mustache -partial", :region=>['eu-central-1'], :ssh => false },
26
+ { :id => "3", :desc=>"EC2 instance configuration using YAML-data", :region=>['eu-central-1'], :ssh => false },
27
+ { :id => "4", :desc=>"Add 'Outputs' -section with reference to EC2 instance", :region=>['eu-central-1'], :ssh => false },
28
+ { :id => "5", :desc=>"Add 'Inputs' and 'Mappings' -sections to parametirize", :region=> all_regions, :ssh => false },
29
+ { :id => "6", :desc=>"Create security group, and EC2 instances", :region=>all_regions, :ssh => true },
30
+ { :id => "7", :desc=>"Add support for installing Chef", :region=>all_regions, :ssh => true },
32
31
 
33
32
 
34
33
  ].each do |c|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-must
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - jarjuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-15 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mustache
@@ -39,17 +39,25 @@ files:
39
39
  - demo/0/root.mustache
40
40
  - demo/1/conf.yaml
41
41
  - demo/1/root.mustache
42
+ - demo/2.old/conf.yaml
43
+ - demo/2.old/root.mustache
42
44
  - demo/2/conf.yaml
45
+ - demo/2/resources.mustache
43
46
  - demo/2/root.mustache
44
47
  - demo/3/conf.yaml
48
+ - demo/3/resource.mustache
49
+ - demo/3/resourceInstance.mustache
45
50
  - demo/3/resources.mustache
46
51
  - demo/3/root.mustache
47
52
  - demo/4/conf.yaml
53
+ - demo/4/output.mustache
48
54
  - demo/4/resource.mustache
49
55
  - demo/4/resourceInstance.mustache
56
+ - demo/4/resourceSecurityGroup.mustache
50
57
  - demo/4/resources.mustache
51
58
  - demo/4/root.mustache
52
59
  - demo/5/conf.yaml
60
+ - demo/5/mappings.mustache
53
61
  - demo/5/output.mustache
54
62
  - demo/5/resource.mustache
55
63
  - demo/5/resourceInstance.mustache
@@ -58,31 +66,24 @@ files:
58
66
  - demo/6/conf.yaml
59
67
  - demo/6/mappings.mustache
60
68
  - demo/6/output.mustache
69
+ - demo/6/parameter.mustache
61
70
  - demo/6/resource.mustache
62
71
  - demo/6/resourceInstance.mustache
72
+ - demo/6/resourceSecurityGroup.mustache
63
73
  - demo/6/resources.mustache
64
74
  - demo/6/root.mustache
75
+ - demo/6/tag.mustache
65
76
  - demo/7/conf.yaml
66
77
  - demo/7/mappings.mustache
67
78
  - demo/7/output.mustache
68
79
  - demo/7/parameter.mustache
69
80
  - demo/7/resource.mustache
70
81
  - demo/7/resourceInstance.mustache
82
+ - demo/7/resourceInstanceChef.mustache
71
83
  - demo/7/resourceSecurityGroup.mustache
72
84
  - demo/7/resources.mustache
73
85
  - demo/7/root.mustache
74
86
  - demo/7/tag.mustache
75
- - demo/8/conf.yaml
76
- - demo/8/mappings.mustache
77
- - demo/8/output.mustache
78
- - demo/8/parameter.mustache
79
- - demo/8/resource.mustache
80
- - demo/8/resourceInstance.mustache
81
- - demo/8/resourceInstanceChef.mustache
82
- - demo/8/resourceSecurityGroup.mustache
83
- - demo/8/resources.mustache
84
- - demo/8/root.mustache
85
- - demo/8/tag.mustache
86
87
  - lib/aws-must.rb
87
88
  - lib/aws-must/aws-must.rb
88
89
  - lib/aws-must/docu.rb
data/demo/8/conf.yaml DELETED
@@ -1,61 +0,0 @@
1
- -- demo/2 : added description property
2
-
3
-
4
- description: "demo/8 - A simple Amazon EC2 instance created using aws-must tool
5
- - Minimum Viable Solution to Manage CloudFormation
6
- Templates. Adds support installing Chef"
7
-
8
- parameters:
9
-
10
- - Name: InstanceType
11
- Type: String
12
- Description: EC2 reousrce instance type
13
- Value: &Param_InstanceType t2.micro
14
-
15
- - Name: &Param_KeyName KeyName
16
- Type: "AWS::EC2::KeyPair::KeyName"
17
- Description: Name of an existing EC2 KeyPair to enable SSH access to the instance
18
- Value: demo-key
19
-
20
- - Name: &Param_SSHLocation SSHLocation
21
- Type: String
22
- Description: The IP address range that can be used to SSH to the EC2 instances
23
- Value: "0.0.0.0/0"
24
-
25
- - Name: ChefVersion
26
- Type: String
27
- Description: Chef version to install
28
- Value: &Param_ChefVersion 11.18
29
-
30
-
31
- resources:
32
-
33
- - InstanceSecurityGroup:
34
- Name: &DefaultSG MyDefaultSecurityGroup
35
- IngressRef: *Param_SSHLocation
36
-
37
- - Instance:
38
- Name: &Resource_1 MyEC2Instance
39
- InstanceType: *Param_InstanceType
40
- KeyName: *Param_KeyName
41
- SecurityGroup: *DefaultSG
42
- InstallChef:
43
- - Version: *Param_ChefVersion
44
- tags:
45
- - Key: demotag1
46
- Value: demotag1 value
47
-
48
-
49
- outputs:
50
-
51
- - Name: Instance1
52
- Description: InstanceId of the newly created EC2 instance
53
- Ref: *Resource_1
54
-
55
-
56
- - Name: IP1
57
- Description: Public IP address of the newly created EC2 instance
58
- Attr:
59
- Ref: *Resource_1
60
- Name: PublicIp
61
-
@@ -1,38 +0,0 @@
1
- {{!
2
-
3
- resource.mustache
4
-
5
- ++start++
6
-
7
- ## <a id="resource.mustache"></a>resource.mustache <a class='navigator' href='#top'">[top]</a>
8
-
9
-
10
- Dispatches resource sub-type templates based resource Type propertys
11
-
12
- **Attributes**: context= `./resources`
13
-
14
- * `Instance`: sub-document defining an EC instance
15
- * `SecurityGroup`: sub-document defining an <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html">AWS::EC2::SecurityGroup</a>
16
-
17
-
18
- **Actions**:
19
-
20
- * **include** <a href="#resourceInstance.mustache">resourceInstance.mustache</a> **if** `Instance`
21
- * **include** <a href="#resourceSecurityGroup.mustache">resourceSecurityGroup.mustache</a> **if** `SecurityGroup`
22
-
23
-
24
- **Included resources**
25
-
26
- * `resourceInstance`
27
-
28
- > resourceInstance
29
- > resourceSecurityGroup.mustache
30
-
31
- ++close++
32
-
33
-
34
-
35
- }}
36
-
37
- {{# Instance }}{{> resourceInstance}}{{/ Instance }}
38
- {{# InstanceSecurityGroup }}{{> resourceSecurityGroup}}{{/ InstanceSecurityGroup }}
@@ -1,50 +0,0 @@
1
- {{!
2
-
3
-
4
- ++start++
5
-
6
-
7
- ## <a id="resourceInstance.mustache"></a>resourceInstance.mustache <a class='navigator' href='#top'">[top]</a>
8
-
9
- Create an EC2 instance
10
-
11
- **Attributes**: context= `./resources/Instance`
12
-
13
- * `Name`: name of the EC2 instance to create
14
- * `InstanceType` : The instance type, such as t2.micro.
15
- * `tags` : array of tag sub-documents for EC2 instance
16
- * `InstallChef`: add UserData to install Chef
17
-
18
-
19
- **Actions**:
20
-
21
- * **Name**: `Name`
22
- * **Type**: 'AWS::EC2::Instance'
23
- * **for** `tag` **in** `tags` **include** <a href="#tag.mustache">tag.mustache</a>
24
- * **SecurityGroups.Ref**: `SecurityGroup` if `SecurityGroup`
25
- * **ImageId**: **AWSRegionArch2AMI**( 'AWS::Region', **AWSInstanceType2Arch**(`InstanceType`))
26
- * **KeyName**: `KeyName` if `KeyName`
27
- * **include** <a href="#resourceInstanceChef.mustache">resourceInstanceChef.mustache</a> if `InstallChef`
28
-
29
- > tag
30
- > resourceInstanceChef
31
-
32
- ++close++
33
-
34
- }}
35
-
36
-
37
- "{{Name}}" : {
38
- "Type" : "AWS::EC2::Instance",
39
- "Properties" : {
40
- "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
41
- { "Fn::FindInMap" : [ "AWSInstanceType2Arch", "{{InstanceType}}", "Arch" ] } ] }
42
- , "InstanceType" : "{{InstanceType}}"
43
- , "Tags" : [ {{#tags}}{{>tag}}{{/tags}} ]
44
- {{#SecurityGroup}}, "SecurityGroups" : [ { "Ref" : "{{SecurityGroup}}" } ]{{/SecurityGroup}}
45
- {{#KeyName}}, "KeyName" : { "Ref" : "{{KeyName}}" }{{/KeyName}}
46
- {{#InstallChef }}, "UserData": { {{> resourceInstanceChef }} }{{/ InstallChef }}
47
- } {{! Propertites }}
48
-
49
-
50
- }{{_comma}}
data/demo/8/root.mustache DELETED
@@ -1,191 +0,0 @@
1
- {{!
2
-
3
- root.mustache: root level template,
4
-
5
- ==================================================================
6
- STYLE section
7
- ==================================================================
8
-
9
- ++start++
10
- <style>
11
- h1 {
12
- color:blue;
13
- font-size: 2.5em;
14
- }
15
- h2 {
16
- color:blue;
17
- font-size: 1.5em;
18
- }
19
- h3 {
20
- color:blue;
21
- font-size: 1.5em;
22
- }
23
- .navigator {
24
- font-size: 0.5em;
25
- }
26
- body {
27
- background-color: #b0c4de;
28
- }
29
- </style>
30
-
31
- ++close++
32
-
33
-
34
- ==================================================================
35
- CONTENT section
36
- ==================================================================
37
-
38
- ++start++
39
-
40
- # <a id="top">aws-must demo 8 template</a>
41
-
42
- Creates
43
-
44
- * **EC2 SecurityGroup** allowing ssh via port 22 from a location
45
- given as `SSHLocation` parameter
46
-
47
-
48
- * **EC2 instances** using YAML parameter `InstanceType`
49
- (e.g. t2.micro).
50
-
51
- * `ImageId` of the AMI is determined using CloudFormation mapping on
52
- `InstanceType` and region. Supported regions are ap-northeast-1,
53
- ap-southeast-1, ap-southeast-2, cn-north-1, eu-central-1,
54
- eu-west-1, sa-east-1, us-east-1, us-gov-west-1, us-west-1,
55
- us-west-2.
56
-
57
- * optionally installs Chef to the EC2 instance with a version given
58
- as `ChefVersion` parameter
59
-
60
- * output section contains references to InstanceId and PublicId of
61
- the newly created EC2 instance.
62
-
63
- **Parameters**:
64
-
65
- * `InstanceType`: EC2 resource instance type, (default: t2.micro)
66
- * `KeyName` : Name of an existing EC2 KeyPair to enable SSH access to the instance, (default: demo-key)
67
- * `SSHLocation`: The IP address range that can be used to SSH to the EC2 instances default: 0.0.0.0/0)
68
- * `ChefVersion`: Chef version to install, (default: 11.18)
69
-
70
-
71
- ## Document Content
72
-
73
- This document is generated automically from `aws-must` -demo
74
- templates.
75
-
76
-
77
- Output contains markdown syntax between
78
- **&plus;&plus;start&plus;&plus;** and
79
- **&plus;&plus;close&plus;&plus;** -tags from the template files. For
80
- each template, it
81
-
82
- * gives a general description of the template
83
-
84
- * documents the attribute context e.g. `.` or `./resources/Instance`,
85
- and attributes referenced within the template
86
-
87
- * lists template actions, i.e. output from template, or template
88
- inclusion
89
-
90
- ### Table of contents
91
- <ul>
92
-
93
- <li><a href="#root.mustache">root.mustache</a>: root template =
94
- starting point of template rendering</li>
95
-
96
- <li><a href="#parameter.mustache">parameter.mustache</a>: create one
97
- parameter entry to CloudFormation JSON parameter section</li>
98
-
99
- <li><a href="#mappings.mustache">mappings.mustache</a>matches a key to
100
- a corresponding set of named values</li>
101
-
102
- <li>Resources</li>
103
-
104
- <ul>
105
-
106
- <li><a href="#resources.mustache">resources.mustache</a>: fixed
107
- resources</li>
108
-
109
- <li><a href="#resource.mustache">resource.mustache</a>: dispatch
110
- resource based on resource type</li>
111
-
112
- <ul> <li><a
113
- href="#resourceSecurityGroup.mustache">resourceSecurityGroup.mustache.mustache</a>:
114
- create an security group for accessing EC2 instances</li>
115
-
116
- <li><a
117
- href="#resourceInstance.mustache">resourceInstance.mustache</a>:
118
- create an EC2 instance</li>
119
-
120
- <ul><li><a href="#tag.mustache">tag.mustache</a>: add key-value tag property
121
- to an</li>
122
-
123
- <li><a href="#resourceInstanceChef.mustache">resourceInstanceChef.mustache</a>: UserData -script to install Chef
124
- to an</li><ul>
125
-
126
- </ul></ul></ul></ul>
127
-
128
- <li><a href="#output.mustache">output.mustache</a>: values in
129
- response to describe stack calls </li> </ul>
130
-
131
-
132
- ## <a id="root.mustache"></a>root.mustache <a class='navigator' href='#top'">[top]</a>
133
-
134
- Starting point of template rendering.
135
-
136
- **Attributes**: context= `.`
137
-
138
- * `description`: description for the CF template
139
- * `parameters`: array of parameter sub-documents for CloudFormation Parameters -section
140
- * `resources`: array of resource sub-documents for CloudFormation Resources -section
141
- * `outputs`: array of output sub-documents for CloudFormation Outputs -section
142
-
143
-
144
- **Actions**:
145
-
146
- * **Description**: `description`
147
- * **for** `parameter` **in** `parameters` **include** <a href="#parameter.mustache">parameter.mustache</a>
148
- * **include** <a href="#mappings.mustache">mappings.mustache</a>
149
- * **include** <a href="#resources.mustache">resources.mustache</a>
150
- * **for** `resource` **in** `resource` **include** <a href="#resource.mustache">resource.mustache</a>
151
- * **for** `output` **in** `outputs` **include** <a href="#output.mustache">output.mustache</a>
152
-
153
-
154
- > parameter
155
- > mappings
156
- > resources
157
- > resource
158
- > output
159
-
160
-
161
- ++close++
162
-
163
- }}
164
-
165
- {
166
- "AWSTemplateFormatVersion" : "2010-09-09",
167
-
168
- "Description" : "{{description}}",
169
-
170
- "Parameters" : {
171
- {{# parameters }}{{> parameter }}{{/ parameters }}
172
- },
173
-
174
- "Mappings" : {
175
- {{> mappings }}
176
- },
177
-
178
- "Resources" : {
179
-
180
- {{> resources }}
181
- {{# resources }}{{> resource }}{{/ resources }}
182
-
183
- },
184
-
185
- "Outputs" : {
186
-
187
- {{# outputs }}{{> output }}{{/ outputs }}
188
-
189
- }
190
-
191
- }