dev-lxc 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 418e5d84f4cd828da09f766360fb63e68ff52fc6
4
- data.tar.gz: eb420a6d8a3fcc30a9ec84e1a43ae63f7b8ea063
3
+ metadata.gz: 8a3771ca6276e259b23247dc765fed666bc6e070
4
+ data.tar.gz: 114ead85a0943232c3013d19c8401a4048fa4357
5
5
  SHA512:
6
- metadata.gz: 71955db99c7af24fdf4ee602e61d5bb669a95500a58baa95d36a8be2a4fd2ebd51894a95bcc315349f0e7308cfe401df8713c85270b49c0d9cd2caba4120a3ed
7
- data.tar.gz: 1a3114175737f4e9396d82cd7ce9924e88705ad42a59d9b05a4741e26c1015a2b29f848885853e9b42b023941c4f35c8e985d2950e6589a4bfd49a4721843e2e
6
+ metadata.gz: 4d05d3ab4875be951a6f6fe478622790732b81db814da9721c81d23b25b5686bfb80495254029324b74161851ffa50be0b01c3359670457ec154bbf35a75ad0e
7
+ data.tar.gz: 19c163c03db6189f526bda198efd48fbc1230a61eb237d513eee4136261464bc96759f13b6b8bd5c31d03647ba054868bde22be113b6ed6cdc2bbacef4afd914
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # dev-lxc Change Log
2
2
 
3
+ ## 3.2.0 (2017-03-10)
4
+
5
+ * Add --base-container and --product-versions options to the `init` subcommand
6
+
3
7
  ## 3.1.0 (2017-03-08)
4
8
 
5
9
  * Add example dev-lxc.yml files
data/README.md CHANGED
@@ -109,10 +109,10 @@ mkdir -p /root/clusters/automate
109
109
  ```
110
110
 
111
111
  The following command creates a dev-lxc.yml file that defines a standalone Chef Server, Supermarket server, Compliance server,
112
- Chef Automate server a Job Dispatch Runner and an infrastructure node.
112
+ Chef Automate server a Job Dispatch Runner and an infrastructure node and removes the "reporting" product from the generated configuration.
113
113
 
114
114
  ```
115
- dl init --chef --compliance --supermarket --automate --runners --nodes > /root/clusters/automate/dev-lxc.yml
115
+ dl init --chef --compliance --supermarket --automate --runners --nodes --product-versions reporting:none > /root/clusters/automate/dev-lxc.yml
116
116
  ```
117
117
 
118
118
  Copy your delivery.license file to the `/root/clusters` directory.
@@ -172,7 +172,7 @@ Since the cluster has a Chef Automate server you can use the `print-automate-cre
172
172
  dl print
173
173
  ```
174
174
 
175
- If you enabled local port forwarding for port 8888 in your workstation's SSH config file and configured your web browser to use `127.0.0.1:8888` for HTTP and HTTPS proxies as described in the [dev-lxc-platform README.md](https://github.com/jeremiahsnapp/dev-lxc-platform) then you should be able to browse from your workstation to any server that has a web interface using its FQDN.
175
+ If you enabled local port forwarding for port 8888 in your workstation's SSH config file and configured your web browser to use `127.0.0.1:8888` for HTTP and HTTPS proxies as described in the [dev-lxc-platform README.md](https://github.com/jeremiahsnapp/dev-lxc-platform#accessing-the-containers-using-a-web-proxy) then you should be able to browse from your workstation to any server that has a web interface using its FQDN.
176
176
 
177
177
  For example, browse to https://automate.lxc and login with the credentials provided by `dl print-automate-credentials`.
178
178
 
@@ -2,13 +2,23 @@
2
2
 
3
3
  dev-lxc uses a YAML configuration file named `dev-lxc.yml` to define a cluster.
4
4
 
5
- The `init` command generates sample config files for various server types.
5
+ The `init` command generates sample config files for various server types. You can run `dl help init` to see the many types of server configurations that can be generated.
6
+
7
+ The `--base-container` option can be used to set the type of base container you want used in the generated configuration.
8
+
9
+ The `--product-versions` option can be used to set the package channel and version to use for multiple products. If a version is not specified then it will default to `latest`. If `none` is used then that product will be removed from the generated configuration.
10
+
11
+ For example, the following command will generate a configuration for a standalone Chef Server that uses the `b-centos-7` base container and install chef-server 12.13.0 from the `stable` channel, the latest version of manage from the `current` channel and remove the reporting product.
12
+
13
+ ```
14
+ dl init --chef --base-container b-centos-7 --product-versions chef-server:stable:12.13.0 manage:current reporting:none
15
+ ```
6
16
 
7
17
  Let's generate a config for a cluster with a standalone Chef Server, Supermarket server,
8
- Compliance server, Chef Automate server and a Job Dispatch Runner.
18
+ Compliance server, Chef Automate server and a Job Dispatch Runner and remove the "reporting" product from the generated configuration.
9
19
 
10
20
  ```
11
- dl init --chef --compliance --supermarket --automate --runners > dev-lxc.yml
21
+ dl init --chef --compliance --supermarket --automate --runners --product-versions reporting:none > dev-lxc.yml
12
22
  ```
13
23
 
14
24
  We can easily append additional configurations to this file. For example, the following command appends an infrastructure node.
@@ -59,9 +69,14 @@ chef-server:
59
69
  ipaddress: 10.0.3.203
60
70
  products:
61
71
  chef-server:
72
+ channel: stable
73
+ version: latest
62
74
  manage:
75
+ channel: stable
76
+ version: latest
63
77
  push-jobs-server:
64
- # reporting:
78
+ channel: stable
79
+ version: latest
65
80
 
66
81
  compliance:
67
82
  admin_user: admin # the password will be the same as the username
@@ -70,6 +85,8 @@ compliance:
70
85
  ipaddress: 10.0.3.205
71
86
  products:
72
87
  compliance:
88
+ channel: stable
89
+ version: latest
73
90
 
74
91
  supermarket:
75
92
  servers:
@@ -77,6 +94,8 @@ supermarket:
77
94
  ipaddress: 10.0.3.206
78
95
  products:
79
96
  supermarket:
97
+ channel: stable
98
+ version: latest
80
99
 
81
100
  automate:
82
101
  servers:
@@ -84,7 +103,9 @@ automate:
84
103
  ipaddress: 10.0.3.200
85
104
  products:
86
105
  automate:
87
- license_path: /path/for/automate.lxc
106
+ channel: stable
107
+ version: latest
108
+ license_path: ../delivery.license
88
109
  chef_org: delivery
89
110
  enterprise_name: demo-ent
90
111
 
@@ -93,6 +114,8 @@ runners:
93
114
  runner-1.lxc:
94
115
  products:
95
116
  chefdk: # downloaded only
117
+ channel: stable
118
+ version: latest
96
119
 
97
120
  nodes:
98
121
  chef_server_url: https://chef.lxc/organizations/demo
@@ -103,6 +126,9 @@ nodes:
103
126
  node-1.lxc:
104
127
  products:
105
128
  chef:
129
+ channel: stable
130
+ version: latest
131
+
106
132
  ```
107
133
 
108
134
  The dev-lxc.yml config file is very customizable. You can add or remove mounts, products or servers,
@@ -2,17 +2,19 @@ The files in this directory are working examples of cluster dev-lxc.yml files. Y
2
2
 
3
3
  ### automate
4
4
 
5
- The [automate_dev-lxc.yml](example-clusters/automate_dev-lxc.yml) file was created using the following command.
5
+ Cluster build time: 19 minutes
6
+
7
+ The [automate_dev-lxc.yml](automate_dev-lxc.yml) file was created using the following command.
6
8
 
7
9
  ```
8
- dl init --chef --compliance --supermarket --automate --runners --nodes
10
+ dl init --chef --compliance --supermarket --automate --runners --nodes --product-versions reporting:none
9
11
  ```
10
12
 
11
- Cluster build time: 19 minutes
12
-
13
13
  ### chef-backend
14
14
 
15
- The [chef-backend_dev-lxc.yml](example-clusters/chef-backend_dev-lxc.yml) file was created using the following command.
15
+ Cluster build time: 12 minutes
16
+
17
+ The [chef-backend_dev-lxc.yml](chef-backend_dev-lxc.yml) file was created using the following command.
16
18
 
17
19
  The nodes' `chef_server_url` hostname was changed to `chef-ha.lxc` and the node's hostname was changed to `node-1-ha.lxc`.
18
20
 
@@ -20,18 +22,14 @@ The nodes' `chef_server_url` hostname was changed to `chef-ha.lxc` and the node'
20
22
  dl init --chef-backend --nodes
21
23
  ```
22
24
 
23
- Cluster build time: 12 minutes
24
-
25
25
  ### tier
26
26
 
27
- The [tier_dev-lxc.yml](example-clusters/tier_dev-lxc.yml) file was created using the following command.
27
+ Cluster build time: 14 minutes
28
28
 
29
- The `reporting` product was uncommented for `chef-be.lxc` and `chef-fe1.lxc`.
29
+ The [tier_dev-lxc.yml](tier_dev-lxc.yml) file was created using the following command.
30
30
 
31
31
  The nodes' `chef_server_url` hostname was changed to `chef-tier.lxc` and the node's hostname was changed to `node-1-tier.lxc`.
32
32
 
33
33
  ```
34
34
  dl init --chef-tier --analytics --nodes
35
35
  ```
36
-
37
- Cluster build time: 14 minutes
@@ -37,9 +37,14 @@ chef-server:
37
37
  ipaddress: 10.0.3.203
38
38
  products:
39
39
  chef-server:
40
+ channel: stable
41
+ version: latest
40
42
  manage:
43
+ channel: stable
44
+ version: latest
41
45
  push-jobs-server:
42
- # reporting:
46
+ channel: stable
47
+ version: latest
43
48
 
44
49
  compliance:
45
50
  admin_user: admin # the password will be the same as the username
@@ -48,6 +53,8 @@ compliance:
48
53
  ipaddress: 10.0.3.205
49
54
  products:
50
55
  compliance:
56
+ channel: stable
57
+ version: latest
51
58
 
52
59
  supermarket:
53
60
  servers:
@@ -55,6 +62,8 @@ supermarket:
55
62
  ipaddress: 10.0.3.206
56
63
  products:
57
64
  supermarket:
65
+ channel: stable
66
+ version: latest
58
67
 
59
68
  automate:
60
69
  servers:
@@ -62,6 +71,8 @@ automate:
62
71
  ipaddress: 10.0.3.200
63
72
  products:
64
73
  automate:
74
+ channel: stable
75
+ version: latest
65
76
  license_path: ../delivery.license
66
77
  chef_org: delivery
67
78
  enterprise_name: demo-ent
@@ -71,6 +82,8 @@ runners:
71
82
  runner-1.lxc:
72
83
  products:
73
84
  chefdk: # downloaded only
85
+ channel: stable
86
+ version: latest
74
87
 
75
88
  nodes:
76
89
  chef_server_url: https://chef.lxc/organizations/demo
@@ -81,3 +94,5 @@ nodes:
81
94
  node-1.lxc:
82
95
  products:
83
96
  chef:
97
+ channel: stable
98
+ version: latest
@@ -40,23 +40,33 @@ chef-backend:
40
40
  leader: true
41
41
  products:
42
42
  chef-backend:
43
+ channel: stable
44
+ version: latest
43
45
  chef-backend2.lxc:
44
46
  ipaddress: 10.0.3.209
45
47
  role: backend
46
48
  products:
47
49
  chef-backend:
50
+ channel: stable
51
+ version: latest
48
52
  chef-backend3.lxc:
49
53
  ipaddress: 10.0.3.210
50
54
  role: backend
51
55
  products:
52
56
  chef-backend:
57
+ channel: stable
58
+ version: latest
53
59
  chef-frontend1.lxc:
54
60
  ipaddress: 10.0.3.211
55
61
  role: frontend
56
62
  bootstrap: true
57
63
  products:
58
64
  chef-server:
65
+ channel: stable
66
+ version: latest
59
67
  manage:
68
+ channel: stable
69
+ version: latest
60
70
 
61
71
  nodes:
62
72
  chef_server_url: https://chef-ha.lxc/organizations/demo
@@ -67,3 +77,5 @@ nodes:
67
77
  node-1-ha.lxc:
68
78
  products:
69
79
  chef:
80
+ channel: stable
81
+ version: latest
@@ -41,23 +41,30 @@ chef-server:
41
41
  bootstrap: true
42
42
  products:
43
43
  chef-server:
44
+ channel: stable
45
+ version: latest
44
46
  push-jobs-server:
45
- # reporting:
47
+ channel: stable
48
+ version: latest
49
+ reporting:
50
+ channel: stable
51
+ version: latest
46
52
  chef-fe1.lxc:
47
53
  ipaddress: 10.0.3.202
48
54
  role: frontend
49
55
  products:
50
56
  chef-server:
57
+ channel: stable
58
+ version: latest
51
59
  manage:
60
+ channel: stable
61
+ version: latest
52
62
  push-jobs-server:
53
- # reporting:
54
-
55
- analytics:
56
- servers:
57
- analytics.lxc:
58
- ipaddress: 10.0.3.204
59
- products:
60
- analytics:
63
+ channel: stable
64
+ version: latest
65
+ reporting:
66
+ channel: stable
67
+ version: latest
61
68
 
62
69
  nodes:
63
70
  chef_server_url: https://chef-tier.lxc/organizations/demo
@@ -68,3 +75,14 @@ nodes:
68
75
  node-1-tier.lxc:
69
76
  products:
70
77
  chef:
78
+ channel: stable
79
+ version: latest
80
+
81
+ analytics:
82
+ servers:
83
+ analytics.lxc:
84
+ ipaddress: 10.0.3.204
85
+ products:
86
+ analytics:
87
+ channel: stable
88
+ version: latest
data/lib/dev-lxc/cli.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'erb'
1
2
  require "yaml"
2
3
  require 'dev-lxc'
3
4
  require 'thor'
@@ -57,15 +58,24 @@ module DevLXC::CLI
57
58
  option :build_nodes, :type => :boolean, :desc => "Build Nodes"
58
59
  option :runners, :type => :boolean, :desc => "Runners"
59
60
  option :adhoc, :type => :boolean, :desc => "Adhoc Servers"
61
+ option :base_container, :default => 'b-ubuntu-1404', :desc => "Specify the base container name"
62
+ option :product_versions, :type => :hash, :default => {}, :desc => "Specify channel and version (default 'latest') for products [product:channel,version ...]; [product:none] removes the product from the config"
60
63
  option :append, :aliases => "-a", :type => :boolean, :desc => "Do not generate the global config header"
61
64
  option :filename, :aliases => "-f", :desc => "Write generated content to FILE rather than standard output."
62
65
  def init
63
- header = %Q(# enable_build_snapshots automatically makes container snapshots at key times during the build process
66
+ product_versions = Hash.new { |hash, key| hash[key] = { channel: 'stable', version: 'latest' } }
67
+ options[:product_versions].keys.each do |product|
68
+ product_versions[product][:channel], product_versions[product][:version] = options[:product_versions][product].to_s.split(',', 2)
69
+ product_versions[product][:version] ||= 'latest'
70
+ end
71
+
72
+ dev_lxc_template = %Q(<% unless options[:append] -%>
73
+ # enable_build_snapshots automatically makes container snapshots at key times during the build process
64
74
  # default value is `true`
65
75
  #enable_build_snapshots: true
66
76
 
67
77
  # base_container must be the name of an existing container
68
- base_container: b-ubuntu-1404
78
+ base_container: <%= options[:base_container] %>
69
79
 
70
80
  # memory_per_server sets the maximum amount of user memory (including file cache) for each server.
71
81
  # dev-lxc will set the `memory.limit_in_bytes` cgroup for each server to apply this limit.
@@ -83,11 +93,10 @@ base_container: b-ubuntu-1404
83
93
  # - /root/clusters/id_rsa.pub
84
94
 
85
95
  # DHCP reserved (static) IPs must be selected from the IP range 10.0.3.150 - 254
86
- )
87
- chef_tier_config = %Q(
96
+ <% end -%>
97
+ <% if options[:chef] -%>
98
+
88
99
  chef-server:
89
- topology: tier
90
- api_fqdn: chef-tier.lxc
91
100
  users: # a user's password will be the same as its username
92
101
  - mary-admin
93
102
  - joe-user
@@ -98,25 +107,93 @@ chef-server:
98
107
  non-admins:
99
108
  - joe-user
100
109
  servers:
101
- chef-be.lxc:
102
- ipaddress: 10.0.3.201
103
- role: backend
104
- bootstrap: true
110
+ chef.lxc:
111
+ ipaddress: 10.0.3.203
105
112
  products:
113
+ <%- unless product_versions['chef-server'][:channel] == 'none' -%>
106
114
  chef-server:
115
+ channel: <%= product_versions['chef-server'][:channel] %>
116
+ version: <%= product_versions['chef-server'][:version] %>
117
+ <%- end -%>
118
+ <%- unless product_versions['manage'][:channel] == 'none' -%>
119
+ manage:
120
+ channel: <%= product_versions['manage'][:channel] %>
121
+ version: <%= product_versions['manage'][:version] %>
122
+ <%- end -%>
123
+ <%- unless product_versions['push-jobs-server'][:channel] == 'none' -%>
107
124
  push-jobs-server:
108
- # reporting:
109
- chef-fe1.lxc:
110
- ipaddress: 10.0.3.202
125
+ channel: <%= product_versions['push-jobs-server'][:channel] %>
126
+ version: <%= product_versions['push-jobs-server'][:version] %>
127
+ <%- end -%>
128
+ <%- unless product_versions['reporting'][:channel] == 'none' -%>
129
+ reporting:
130
+ channel: <%= product_versions['reporting'][:channel] %>
131
+ version: <%= product_versions['reporting'][:version] %>
132
+ <%- end -%>
133
+ <% end -%>
134
+ <% if options[:chef_backend] -%>
135
+
136
+ chef-backend:
137
+ api_fqdn: chef-ha.lxc
138
+ users: # a user's password will be the same as its username
139
+ - mary-admin
140
+ - joe-user
141
+ orgs:
142
+ demo:
143
+ admins:
144
+ - mary-admin
145
+ non-admins:
146
+ - joe-user
147
+ servers:
148
+ chef-backend1.lxc:
149
+ ipaddress: 10.0.3.208
150
+ role: backend
151
+ leader: true
152
+ products:
153
+ <%- unless product_versions['chef-backend'][:channel] == 'none' -%>
154
+ chef-backend:
155
+ channel: <%= product_versions['chef-backend'][:channel] %>
156
+ version: <%= product_versions['chef-backend'][:version] %>
157
+ <%- end -%>
158
+ chef-backend2.lxc:
159
+ ipaddress: 10.0.3.209
160
+ role: backend
161
+ products:
162
+ <%- unless product_versions['chef-backend'][:channel] == 'none' -%>
163
+ chef-backend:
164
+ channel: <%= product_versions['chef-backend'][:channel] %>
165
+ version: <%= product_versions['chef-backend'][:version] %>
166
+ <%- end -%>
167
+ chef-backend3.lxc:
168
+ ipaddress: 10.0.3.210
169
+ role: backend
170
+ products:
171
+ <%- unless product_versions['chef-backend'][:channel] == 'none' -%>
172
+ chef-backend:
173
+ channel: <%= product_versions['chef-backend'][:channel] %>
174
+ version: <%= product_versions['chef-backend'][:version] %>
175
+ <%- end -%>
176
+ chef-frontend1.lxc:
177
+ ipaddress: 10.0.3.211
111
178
  role: frontend
179
+ bootstrap: true
112
180
  products:
181
+ <%- unless product_versions['chef-server'][:channel] == 'none' -%>
113
182
  chef-server:
183
+ channel: <%= product_versions['chef-server'][:channel] %>
184
+ version: <%= product_versions['chef-server'][:version] %>
185
+ <%- end -%>
186
+ <%- unless product_versions['manage'][:channel] == 'none' -%>
114
187
  manage:
115
- push-jobs-server:
116
- # reporting:
117
- )
118
- chef_config = %Q(
188
+ channel: <%= product_versions['manage'][:channel] %>
189
+ version: <%= product_versions['manage'][:version] %>
190
+ <%- end -%>
191
+ <% end -%>
192
+ <% if options[:chef_tier] -%>
193
+
119
194
  chef-server:
195
+ topology: tier
196
+ api_fqdn: chef-tier.lxc
120
197
  users: # a user's password will be the same as its username
121
198
  - mary-admin
122
199
  - joe-user
@@ -127,136 +204,162 @@ chef-server:
127
204
  non-admins:
128
205
  - joe-user
129
206
  servers:
130
- chef.lxc:
131
- ipaddress: 10.0.3.203
207
+ chef-be.lxc:
208
+ ipaddress: 10.0.3.201
209
+ role: backend
210
+ bootstrap: true
211
+ products:
212
+ <%- unless product_versions['chef-server'][:channel] == 'none' -%>
213
+ chef-server:
214
+ channel: <%= product_versions['chef-server'][:channel] %>
215
+ version: <%= product_versions['chef-server'][:version] %>
216
+ <%- end -%>
217
+ <%- unless product_versions['push-jobs-server'][:channel] == 'none' -%>
218
+ push-jobs-server:
219
+ channel: <%= product_versions['push-jobs-server'][:channel] %>
220
+ version: <%= product_versions['push-jobs-server'][:version] %>
221
+ <%- end -%>
222
+ <%- unless product_versions['reporting'][:channel] == 'none' -%>
223
+ reporting:
224
+ channel: <%= product_versions['reporting'][:channel] %>
225
+ version: <%= product_versions['reporting'][:version] %>
226
+ <%- end -%>
227
+ chef-fe1.lxc:
228
+ ipaddress: 10.0.3.202
229
+ role: frontend
132
230
  products:
231
+ <%- unless product_versions['chef-server'][:channel] == 'none' -%>
133
232
  chef-server:
233
+ channel: <%= product_versions['chef-server'][:channel] %>
234
+ version: <%= product_versions['chef-server'][:version] %>
235
+ <%- end -%>
236
+ <%- unless product_versions['manage'][:channel] == 'none' -%>
134
237
  manage:
238
+ channel: <%= product_versions['manage'][:channel] %>
239
+ version: <%= product_versions['manage'][:version] %>
240
+ <%- end -%>
241
+ <%- unless product_versions['push-jobs-server'][:channel] == 'none' -%>
135
242
  push-jobs-server:
136
- # reporting:
137
- )
138
- automate_config = %Q(
243
+ channel: <%= product_versions['push-jobs-server'][:channel] %>
244
+ version: <%= product_versions['push-jobs-server'][:version] %>
245
+ <%- end -%>
246
+ <%- unless product_versions['reporting'][:channel] == 'none' -%>
247
+ reporting:
248
+ channel: <%= product_versions['reporting'][:channel] %>
249
+ version: <%= product_versions['reporting'][:version] %>
250
+ <%- end -%>
251
+ <% end -%>
252
+ <% if options[:compliance] -%>
253
+
254
+ compliance:
255
+ admin_user: admin # the password will be the same as the username
256
+ servers:
257
+ compliance.lxc:
258
+ ipaddress: 10.0.3.205
259
+ products:
260
+ <%- unless product_versions['compliance'][:channel] == 'none' -%>
261
+ compliance:
262
+ channel: <%= product_versions['compliance'][:channel] %>
263
+ version: <%= product_versions['compliance'][:version] %>
264
+ <%- end -%>
265
+ <% end -%>
266
+ <% if options[:supermarket] -%>
267
+
268
+ supermarket:
269
+ servers:
270
+ supermarket.lxc:
271
+ ipaddress: 10.0.3.206
272
+ products:
273
+ <%- unless product_versions['supermarket'][:channel] == 'none' -%>
274
+ supermarket:
275
+ channel: <%= product_versions['supermarket'][:channel] %>
276
+ version: <%= product_versions['supermarket'][:version] %>
277
+ <%- end -%>
278
+ <% end -%>
279
+ <% if options[:automate] -%>
280
+
139
281
  automate:
140
282
  servers:
141
283
  automate.lxc:
142
284
  ipaddress: 10.0.3.200
143
285
  products:
286
+ <%- unless product_versions['automate'][:channel] == 'none' -%>
144
287
  automate:
288
+ channel: <%= product_versions['automate'][:channel] %>
289
+ version: <%= product_versions['automate'][:version] %>
290
+ <%- end -%>
145
291
  license_path: ../delivery.license
146
292
  chef_org: delivery
147
293
  enterprise_name: demo-ent
148
- )
149
- build_nodes_config = %Q(
294
+ <% end -%>
295
+ <% if options[:build_nodes] -%>
296
+
150
297
  build-nodes:
151
298
  servers:
152
299
  build-node-1.lxc:
153
300
  products:
301
+ <%- unless product_versions['chefdk'][:channel] == 'none' -%>
154
302
  chefdk: # downloaded only
155
- )
156
- runners_config = %Q(
303
+ channel: <%= product_versions['chefdk'][:channel] %>
304
+ version: <%= product_versions['chefdk'][:version] %>
305
+ <%- end -%>
306
+ <% end -%>
307
+ <% if options[:runners] -%>
308
+
157
309
  runners:
158
310
  servers:
159
311
  runner-1.lxc:
160
312
  products:
313
+ <%- unless product_versions['chefdk'][:channel] == 'none' -%>
161
314
  chefdk: # downloaded only
162
- )
163
- analytics_config = %Q(
315
+ channel: <%= product_versions['chefdk'][:channel] %>
316
+ version: <%= product_versions['chefdk'][:version] %>
317
+ <%- end -%>
318
+ <% end -%>
319
+ <% if options[:nodes] -%>
320
+
321
+ nodes:
322
+ chef_server_url: https://chef.lxc/organizations/demo
323
+ validation_client_name: demo-validator
324
+ # comment out or remove the validation_key path to use chef-server keys generated by dev-lxc
325
+ validation_key: # /path/for/ORG-validator.pem
326
+ servers:
327
+ node-1.lxc:
328
+ products:
329
+ <%- unless product_versions['chef'][:channel] == 'none' -%>
330
+ chef:
331
+ channel: <%= product_versions['chef'][:channel] %>
332
+ version: <%= product_versions['chef'][:version] %>
333
+ <%- end -%>
334
+ <% end -%>
335
+ <% if options[:analytics] -%>
336
+
164
337
  analytics:
165
338
  servers:
166
339
  analytics.lxc:
167
340
  ipaddress: 10.0.3.204
168
341
  products:
342
+ <%- unless product_versions['analytics'][:channel] == 'none' -%>
169
343
  analytics:
170
- )
171
- compliance_config = %Q(
172
- compliance:
173
- admin_user: admin # the password will be the same as the username
174
- servers:
175
- compliance.lxc:
176
- ipaddress: 10.0.3.205
177
- products:
178
- compliance:
179
- )
180
- supermarket_config = %Q(
181
- supermarket:
182
- servers:
183
- supermarket.lxc:
184
- ipaddress: 10.0.3.206
185
- products:
186
- supermarket:
187
- )
188
- adhoc_config = %Q(
344
+ channel: <%= product_versions['analytics'][:channel] %>
345
+ version: <%= product_versions['analytics'][:version] %>
346
+ <%- end -%>
347
+ <% end -%>
348
+ <% if options[:adhoc] -%>
349
+
189
350
  adhoc:
190
351
  servers:
191
352
  adhoc.lxc:
192
353
  ipaddress: 10.0.3.207
354
+ <% end -%>
193
355
  )
194
- chef_backend_config = %Q(
195
- chef-backend:
196
- api_fqdn: chef-ha.lxc
197
- users: # a user's password will be the same as its username
198
- - mary-admin
199
- - joe-user
200
- orgs:
201
- demo:
202
- admins:
203
- - mary-admin
204
- non-admins:
205
- - joe-user
206
- servers:
207
- chef-backend1.lxc:
208
- ipaddress: 10.0.3.208
209
- role: backend
210
- leader: true
211
- products:
212
- chef-backend:
213
- chef-backend2.lxc:
214
- ipaddress: 10.0.3.209
215
- role: backend
216
- products:
217
- chef-backend:
218
- chef-backend3.lxc:
219
- ipaddress: 10.0.3.210
220
- role: backend
221
- products:
222
- chef-backend:
223
- chef-frontend1.lxc:
224
- ipaddress: 10.0.3.211
225
- role: frontend
226
- bootstrap: true
227
- products:
228
- chef-server:
229
- manage:
230
- )
231
- nodes_config = %Q(
232
- nodes:
233
- chef_server_url: https://chef.lxc/organizations/demo
234
- validation_client_name: demo-validator
235
- # comment out or remove the validation_key path to use chef-server keys generated by dev-lxc
236
- validation_key: # /path/for/ORG-validator.pem
237
- servers:
238
- node-1.lxc:
239
- products:
240
- chef:
241
- )
242
- config = ""
243
- config += header unless options[:append]
244
- config += chef_config if options[:chef]
245
- config += chef_tier_config if options[:chef_tier]
246
- config += analytics_config if options[:analytics]
247
- config += compliance_config if options[:compliance]
248
- config += supermarket_config if options[:supermarket]
249
- config += automate_config if options[:automate]
250
- config += build_nodes_config if options[:build_nodes]
251
- config += runners_config if options[:runners]
252
- config += adhoc_config if options[:adhoc]
253
- config += chef_backend_config if options[:chef_backend]
254
- config += nodes_config if options[:nodes]
356
+
357
+ dev_lxc_config = ERB.new(dev_lxc_template, nil, '-').result(binding)
255
358
  if options[:filename]
256
359
  mode = options[:append] ? 'a' : 'w'
257
- IO.write(options[:filename], config, mode: mode)
360
+ IO.write(options[:filename], dev_lxc_config, mode: mode)
258
361
  else
259
- puts config
362
+ puts dev_lxc_config
260
363
  end
261
364
  end
262
365
 
@@ -1,3 +1,3 @@
1
1
  module DevLXC
2
- VERSION = "3.1.0"
2
+ VERSION = "3.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev-lxc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremiah Snapp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-08 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler