diff --git a/recipes/rhel.rb b/recipes/rhel.rb index 4864c97..e922173 100644 --- a/recipes/rhel.rb +++ b/recipes/rhel.rb @@ -8,30 +8,12 @@ # Apache 2.0 License. # -# This recipe sets the timezone on EL 6 and older (RedHat Enterprise Linux, -# CentOS, etc.) -# # If it is being run on EL 7 or newer, the recipe will be skipped and # the "rhel7" recipe will be included instead. - el_version = node[:platform_version].split('.')[0].to_i -if el_version >= 7 +if node.platform != 'amazon' && el_version >= 7 include_recipe 'timezone-ii::rhel7' - else - template '/etc/sysconfig/clock' do - source 'clock.erb' - owner 'root' - group 'root' - mode 0644 - notifies :run, 'execute[tzdata-update]' - end - - execute 'tzdata-update' do - command '/usr/sbin/tzdata-update' - action :nothing - # Amazon Linux doesn't have this command! - only_if { ::File.executable?('/usr/sbin/tzdata-update') } - end + include_recipe 'timezone-ii::rhel_pre7' end diff --git a/recipes/rhel_pre7.rb b/recipes/rhel_pre7.rb new file mode 100644 index 0000000..f684557 --- /dev/null +++ b/recipes/rhel_pre7.rb @@ -0,0 +1,28 @@ +# +# Cookbook Name:: timezone-ii +# Recipe:: rhel +# +# Copyright 2013, fraD00r4 +# Copyright 2015, Lawrence Leonard Gilbert +# +# Apache 2.0 License. +# + +# This recipe sets the timezone on EL 6 and older (RedHat Enterprise Linux, +# CentOS, etc.) +# + +template '/etc/sysconfig/clock' do + source 'clock.erb' + owner 'root' + group 'root' + mode 0644 + notifies :run, 'execute[tzdata-update]' +end + +execute 'tzdata-update' do + command '/usr/sbin/tzdata-update' + action :nothing + # Amazon Linux doesn't have this command! + only_if { ::File.executable?('/usr/sbin/tzdata-update') } +end