cookbook 'timezone_iii', '~> 1.1.7'
The timezone_iii cookbook has been deprecated
Author provided reason for deprecation:
The timezone_iii cookbook has been deprecated and is no longer being maintained by its authors. Use of the timezone_iii cookbook is no longer recommended.
timezone_iii (13) Versions 1.1.7 Follow4
Configures the timezone for node
cookbook 'timezone_iii', '~> 1.1.7', :supermarket
knife supermarket install timezone_iii
knife supermarket download timezone_iii
This cookbook is deprectated and as of chef 14.6 is now apart of chef resources https://docs.chef.io/resource_timezone.html
timezone_iii
The Timezone III cookbook contains recipes for installing the latest tzdata (a.k.a. IANA or Olson) timezone database and setting the timezone on your system. It is a fork of the timezone-ii cookbook by Lawrence Gilbert..
Requirements
Amazon Linux should use chef-client 13. The default recipe picks the correct recipe to run based on node['platform_family']. In chef-client 13 ohai assigns amazon as it's own platform_family instead of rhel in previous chef-clients.
This cookbook is known to work with:
- Amazon Linux
- CentOS and RHEL
- Debian
- Fedora
- Gentoo
- PLD Linux
- Ubuntu
- Windows
It should work with any OS that uses the IANA/Olson timezone database and stores local timezone data in /etc/localtime (the only OS I know of that does not do this is MS Windows). However, some OSs not mentioned above have their own system utility for setting the timezone, and this may overwrite the changes made by this cookbook.
Attributes
Attribute | Default | Comment |
---|---|---|
['timezone_iii']['timezone'] | 'value_for_platform_family(debian: 'Etc/UTC', default: 'UTC')' | String, timezone to set OS to; See timezone_iii::windows below for windows |
['timezone_iii']['clock_utc'] | nil |
String(true,false), UTC setting in /etc/sysconfig/clock (RHEL family only) |
['timezone_iii']['tzdata_dir'] | '/usr/share/zoneinfo' | String, the path to the root of the tzdata files; the default value is for most known distributions of Linux |
['timezone_iii']['localtime_path'] | '/etc/localtime' | String, the path to the file used by the kernel to read the local timezone's settings; the default works for Linux and other *ix variants |
['timezone_iii']['use_symlink'] | false | Boolean, whether to use a symlink into the tzdata tree rather than make a copy of the appropriate timezone data file (amazon and linux_generic recipes only) |
Usage
Set the ['timezone_iii']['timezone'] attribute to your desired timezone and include the "timezone_iii" recipe in your node's run list:
{
"name": "my_node",
"timezone_iii" {
"timezone": "Africa/Timbuktu"
},
"run_list": [
"recipe[timezone_iii]"
]
}
timezone_iii::default
The default recipe will first install or upgrade the IANA/Olson timezone database package for your OS (timezone-data
on Gentoo, tzdata
on all other linux platforms). Then it will call one of the recipes below according to your node's platform.
timezone_iii::amazon
This changes the timezone on Amazon Linux by:
- including the "timezone_iii::linux_generic" recipe then;
- including the "timezone_iii::rhel" recipe.
Refer to the sections for those recipes for details.
timezone_iii::debian
This changes the timezone on Debian-family platforms by:
- writing the value of
['timezone_iii']['timezone']
to/etc/timezone
then; - calling
dpkg-reconfigure -f noninteractive tzdata
; - if
dpkg-reconfigure
amends the timezone value (e.g. by changing "UTC" to "Etc/UTC" or "EET" to "Europe/Helsinki"), it logs a warning.
Only the ['timezone_iii']['timezone']
attribute is used; all others are ignored.
timezone_iii::linux_generic
This changes the time on all OSs without a more specific recipe. It assumes that the kernel gets data on the local timezone from /etc/localtime
. (This is true for FreeBSD as well as Linux, so "linux_generic" is a bit of a misnomer.)
What this recipe does:
- verifies that the value of
['timezone_iii']['timezone']
corresponds with a timezone data file under the directory specified intimezone.tzdata_dir
(default:/usr/share/zoneinfo
), then; - creates a copy of or symbolic link to that data file in the path specified in
timezone.localtime_path
(default:/etc/localtime
).
The truthiness of timezone.use_symlink
(default: false
) determines whether a symlink or a copy is made.
timezone_iii::pld
This changes the timezone on PLD Linux. It writes the appropriate timezone configuration file, making use of the ['timezone_iii']['timezone']
and ['timezone_iii']['tzdata_dir']
attributes. Other attributes are ignored.
timezone_iii::rhel
This changes the timezone on RedHat Enterprise Linux (RHEL) and RHEL-family platforms such as CentOS. It is intended only for versions prior to 7.0, but should the recipe be called on a system with version 7.0 or newer, it will automatically include the "timezone_iii::rhel7" recipe and do nothing else.
This recipe updates the /etc/sysconfig/clock
file with the value of the ['timezone_iii']['timezone']
attribute, then calls tzdata-update
(if available) to change the timezone. All node attributes other than ['timezone_iii']['timezone']
are ignored.
timezone_iii::rhel7
This changes the timezone on EL 7 platforms by calling timedatectl set-timezone
with the value of ['timezone_iii']['timezone']
.
Only the ['timezone_iii']['timezone']
attribute is used; all others are ignored.
timezone_iii::windows
This changes the timezone on windows platforms by calling tzutil.exe
with the value of ['timezone_iii']['timezone']
. To get a list of timezones to use with windows you can run the command tzutil.exe /l | more
on the command line and use the standard name under the offset info.
Only the ['timezone_iii']['timezone']
attribute is used; all others are ignored.
Contributing
- Fork the repository on GitHub;
- Write your change;
- If at all possible, write tests for your change and ensure they all pass;
- Submit a pull request using GitHub.
Acknowledgements
Thanks to:
- Larry Gilbert, for launching the timezone-ii cookbook
- James Harton, for launching the timezone cookbook
- Elan Ruusamäe, for PLD support
- Mike Conigliaro, for bringing testing up to date
- "fraD00r4", for RHEL/CentOS support
License and Authors
- Copyright © 2010 James Harton james@sociable.co.nz
- Copyright © 2013-2015 Lawrence Leonard Gilbert larry@L2G.to
- Copyright © 2013 Elan Ruusamäe glen@delfi.ee
- Copyright © 2013 fraD00r4 frad00r4@gmail.com
- Copyright © 2017 Corey Hemminger hemminger@hotmail.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
CHANGELOG for timezone_iii
1.1.7 (10/17/2018)
- [iamjohnnym] - Added Ubuntu-18.04 into Kitchen
1.1.6 (12/30/2017)
- [limitusus] - Removed unnecessary RHEL7 recipe resources
1.1.5 (12/27/2017)
- [limitusus] - Fixed debian recipe resource to be more chef like.
1.1.4 (12/6/2017)
- [limitusus] - Fixed idempotency to be more chef like in generic-linux recipe
1.1.3 (12/4/2017)
- [limitusus] - Fixed typo in template attribute
1.1.2 (12/1/2017)
- [borgified] - Fixed rhel7 execute resource idempotency
1.1.1 (12/1/2017)
- [BradBeveridge] - Added Suse Support
- [patkar] - Fixed Debian script interpolation
- [limitusus] - Added UTC attribute to rhel template
1.0.4 (6/6/2017)
- [badsector3] - Temp fix for recent Ubuntu releases with local time file overriding timezone file
1.0.3 (4/20/2017)
- [Corey Hemminger] - fixed linux include_recipe line that was being skipped
1.0.2 (4/19/2017)
- [Corey Hemminger] - changed hash rockets to new hash style
1.0.1 (4/18/2017)
- [Corey Hemminger] - fixed windows idempotency
1.0.0 (4/18/2017)
- [Corey Hemminger] - Initial commit
Collaborator Number Metric
1.1.7 failed this metric
Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.1.7 passed this metric
Foodcritic Metric
1.1.7 passed this metric
No Binaries Metric
1.1.7 passed this metric
Testing File Metric
1.1.7 passed this metric
Version Tag Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.7 failed this metric
1.1.7 passed this metric
Foodcritic Metric
1.1.7 passed this metric
No Binaries Metric
1.1.7 passed this metric
Testing File Metric
1.1.7 passed this metric
Version Tag Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.7 passed this metric
1.1.7 passed this metric
Testing File Metric
1.1.7 passed this metric
Version Tag Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.7 passed this metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number