Skip to content

Commit 13f5f69

Browse files
committed
2.1.6 - Read Changelog
1 parent 693e340 commit 13f5f69

File tree

6 files changed

+72
-65
lines changed

6 files changed

+72
-65
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## CHANGE LOG
22

3+
## 2.1.6 - 04/15/2017 - Levon Becker
4+
* Fixed CloudWatch Logs Config order so default with us-east-1 no longer left
5+
* Added CloudWatch Logs /var/log/chef-client.log stream
6+
* Added Client.rb updated to log chef run to /var/log/chef-client.log
7+
* CFN: Renamed AMI map last key from EBS to amazon
8+
* CFN: Removed role since just calling the recipe for run list and change chef run to call the recipe instead.
9+
310
## 2.1.5 - 04/13/2017 - Levon Becker
411
* Upgraded and test with chefdk 1.3.40 / chef-client 12.19.36
512

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ARG chef_role=base
99
ARG chef_environment=bonusbits_base
1010
ARG chef_config_path=/opt/chef-repo
1111

12-
LABEL version="2.1.5" \
12+
LABEL version="2.1.6" \
1313
description="Amazon Linux Image built from bonusbits_base cookbook." \
1414
github="https://github.com/bonusbits/bonusbits_base" \
1515
website="https://www.bonusbits.com"

cloudformation/bonusbits-base.yml

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Outputs:
152152
# Generated
153153
AMI:
154154
Description: AMI Used.
155-
Value: !FindInMap [ RegionMap, !Ref "AWS::Region", EBS ]
155+
Value: !FindInMap [ RegionMap, !Ref "AWS::Region", amazon ]
156156
IAMRole:
157157
Description: IAM Instance Profile Role Created.
158158
Value: !Ref IamRole
@@ -162,52 +162,52 @@ Mappings:
162162
# Amazon Linux AMI 2017.03 was released on 2017-04-04
163163
# N. Virginia
164164
us-east-1:
165-
EBS: ami-22ce4934
165+
amazon: ami-22ce4934
166166
# Ohio
167167
us-east-2:
168-
EBS: ami-7bfcd81e
168+
amazon: ami-7bfcd81e
169169
# Oregon
170170
us-west-2:
171-
EBS: ami-8ca83fec
171+
amazon: ami-8ca83fec
172172
# N. California
173173
us-west-1:
174-
EBS: ami-9e247efe
174+
amazon: ami-9e247efe
175175
# Canada
176176
ca-central-1:
177-
EBS: ami-8601bce2
177+
amazon: ami-8601bce2
178178
# Ireland
179179
eu-west-1:
180-
EBS: ami-e5083683
180+
amazon: ami-e5083683
181181
# London
182182
eu-west-2:
183-
EBS: ami-11130775
183+
amazon: ami-11130775
184184
# Frankfurt
185185
eu-central-1:
186-
EBS: ami-5b06d634
186+
amazon: ami-5b06d634
187187
# Singapore
188188
ap-southeast-1:
189-
EBS: ami-a2bc03c1
189+
amazon: ami-a2bc03c1
190190
# Seoul
191191
ap-northeast-1:
192-
EBS: ami-8369baed
192+
amazon: ami-8369baed
193193
# Tokyo
194194
ap-northeast-2:
195-
EBS: ami-859bbfe2
195+
amazon: ami-859bbfe2
196196
# Sydney
197197
ap-southeast-2:
198-
EBS: ami-8bf2fde8
198+
amazon: ami-8bf2fde8
199199
# Mumbai
200200
ap-south-1:
201-
EBS: ami-815625ee
201+
amazon: ami-815625ee
202202
# Sao Paulo
203203
sa-east-1:
204-
EBS: ami-a97013c5
204+
amazon: ami-a97013c5
205205
# Beijing
206206
cn-north-1:
207-
EBS: ami-b3d80ede
207+
amazon: ami-b3d80ede
208208
# GovCloud
209209
us-gov-west-1:
210-
EBS: ami-700a8f11
210+
amazon: ami-700a8f11
211211

212212
Conditions:
213213
# Condition for if SSH access not wanted for maybe a prd env
@@ -327,7 +327,7 @@ Resources:
327327
- IamInstanceProfile
328328
Properties:
329329
AssociatePublicIpAddress: false
330-
ImageId: !FindInMap [ RegionMap, !Ref "AWS::Region", EBS ]
330+
ImageId: !FindInMap [ RegionMap, !Ref "AWS::Region", amazon ]
331331
SecurityGroups: !Ref SecurityGroups
332332
InstanceType: !Ref InstanceType
333333
IamInstanceProfile: !Ref IamInstanceProfile
@@ -399,11 +399,11 @@ Resources:
399399
cwd: /opt/chef-repo
400400
command: !Sub "cp -R cookbooks/${CookbookName}/test/data_bags/${CookbookName} data_bags/"
401401
05_download_dependent_cookbook:
402-
cwd: !Sub /opt/chef-repo/cookbooks/${CookbookName}
402+
cwd: !Sub "/opt/chef-repo/cookbooks/${CookbookName}"
403403
command: !Sub "/opt/chefdk/embedded/bin/berks install"
404404
06_vendor_dependent_cookbook:
405-
cwd: !Sub /opt/chef-repo/cookbooks/${CookbookName}
406-
command: !Sub "/opt/chefdk/embedded/bin/berks vendor /opt/chef-repo/cookbooks/"
405+
cwd: !Sub "/opt/chef-repo/cookbooks/${CookbookName}"
406+
command: !Sub "export HOME=/root && /opt/chefdk/embedded/bin/berks vendor /opt/chef-repo/cookbooks/"
407407
files:
408408
"/opt/chef-repo/encrypted_data_bag_secret":
409409
content: !Sub ${DataBagSecret}
@@ -419,6 +419,9 @@ Resources:
419419
role_path '/opt/chef-repo/roles'
420420
chef_server_url 'http://127.0.0.1:8889'
421421
encrypted_data_bag_secret '/opt/chef-repo/data_bags/encrypted_data_bag_secret'
422+
log_level :info
423+
log_location '/var/log/chef-client.log'
424+
verify_api_cert false
422425
"/opt/chef-repo/environments/aws.json":
423426
content: !Sub |
424427
{
@@ -437,26 +440,10 @@ Resources:
437440
}
438441
}
439442
}
440-
"/opt/chef-repo/roles/ec2.json":
441-
content: !Sub |
442-
{
443-
"name": "ec2",
444-
"description": "Role",
445-
"json_class": "Chef::Role",
446-
"default_attributes": {},
447-
"override_attributes": {
448-
},
449-
"chef_type": "role",
450-
"run_list": [
451-
"recipe[${CookbookName}]"
452-
],
453-
"env_run_lists": {
454-
}
455-
}
456443
run_chef_client:
457444
commands:
458445
01_run_chef:
459-
command: "/opt/chefdk/bin/chef-client -z -o 'role[ec2]' --environment 'aws' --config /opt/chef-repo/client.rb --log_level info --force-formatter --chef-zero-port 8889"
446+
command: !Sub "/opt/chefdk/bin/chef-client -z -o 'recipe[${CookbookName}]' --environment 'aws' --config /opt/chef-repo/client.rb --log_level info --force-formatter --chef-zero-port 8889"
460447
warm_ebs:
461448
commands:
462449
01_warm_ebs:

metadata.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
license 'MIT'
55
description 'Foundation Wrapper Cookbook for all Nodes'
66
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7-
version '2.1.5'
7+
version '2.1.6'
88
chef_version '~> 12.5' if respond_to?(:chef_version)
99
source_url 'https://github.com/bonusbits/bonusbits_base'
1010
issues_url 'https://github.com/bonusbits/bonusbits_base/issues'

recipes/cloudwatch_logs.rb

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
11
case node['os']
22
when 'linux'
3-
directory '/etc/awslogs' do
4-
owner 'root'
5-
group 'root'
6-
mode '0755'
7-
end
8-
9-
# Deploy AWS CLI Config
10-
template '/etc/awslogs/awscli.conf' do
11-
source 'cloudwatch_logs/awscli.conf.erb'
12-
owner 'root'
13-
group 'root'
14-
mode '0644'
15-
end
16-
17-
# Deploy AWS CloudWatch Logs Proxy Config
18-
template '/etc/awslogs/proxy.conf' do
19-
source 'cloudwatch_logs/proxy.conf.erb'
20-
owner 'root'
21-
group 'root'
22-
mode '0644'
23-
notifies :restart, 'service[awslogs]', :delayed
24-
only_if { node['bonusbits_base']['proxy']['configure'] }
25-
end
26-
273
case node['platform']
284
when 'amazon'
295
# Install CloudWatch Logs Agent
306
package 'awslogs'
317
when 'centos', 'redhat', 'ubuntu' # ~FC024
328
package 'python'
339

10+
# TODO: Needed?
11+
directory '/etc/awslogs' do
12+
owner 'root'
13+
group 'root'
14+
mode '0755'
15+
end
16+
3417
local_download_temp = node['bonusbits_base']['local_file_cache']
3518
# Install CloudWatch Logs Agent
3619
ruby_block 'Install CloudWatch Logs Agent' do
@@ -85,6 +68,24 @@
8568
return
8669
end
8770

71+
# Deploy AWS CLI Config
72+
template '/etc/awslogs/awscli.conf' do
73+
source 'cloudwatch_logs/awscli.conf.erb'
74+
owner 'root'
75+
group 'root'
76+
mode '0644'
77+
end
78+
79+
# Deploy AWS CloudWatch Logs Proxy Config
80+
template '/etc/awslogs/proxy.conf' do
81+
source 'cloudwatch_logs/proxy.conf.erb'
82+
owner 'root'
83+
group 'root'
84+
mode '0644'
85+
notifies :restart, 'service[awslogs]', :delayed
86+
only_if { node['bonusbits_base']['proxy']['configure'] }
87+
end
88+
8889
# Deploy AWS CloudWatch Logs Config
8990
template '/etc/awslogs/awslogs.conf' do
9091
source 'cloudwatch_logs/awslogs.conf.erb'

templates/default/cloudwatch_logs/awslogs.conf.erb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,16 @@ file = /var/log/cfn-init-cmd.log
2929
log_group_name = <%= node['bonusbits_base']['cloudwatch_logs']['logs_group_name'] %>
3030
log_stream_name = <%= "#{node['ec2']['instance_id']}-yum" %>
3131
datetime_format = %b %d %H:%M:%S
32-
file = /var/log/yum.log
32+
file = /var/log/yum.log
33+
34+
[cron]
35+
log_group_name = <%= node['bonusbits_base']['cloudwatch_logs']['logs_group_name'] %>
36+
log_stream_name = <%= "#{node['ec2']['instance_id']}-cron" %>
37+
datetime_format = %b %d %H:%M:%S
38+
file = /var/log/cron
39+
40+
[chef-client]
41+
log_group_name = <%= node['bonusbits_base']['cloudwatch_logs']['logs_group_name'] %>
42+
log_stream_name = <%= "#{node['ec2']['instance_id']}-chef-client" %>
43+
datetime_format = [%Y-%m-%dT%H:%M:%S-%z]
44+
file = /var/log/chef-client.log

0 commit comments

Comments
 (0)