Git Product home page Git Product logo

cookbook-timezone-ii's Introduction

Timezone II

The Timezone II 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 cookbook by James Harton.

Requirements

This cookbook is known to work with:

  • Amazon Linux
  • CentOS
  • Debian
  • Fedora
  • Gentoo
  • Ubuntu

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

Key Type Description Default
['tz'] String the timezone name as defined in tzdata UTC
['timezone']['tzdata_dir'] String the path to the root of the tzdata files; the default value is for most known distributions of Linux /usr/share/zoneinfo
['timezone']['localtime_path'] 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 /etc/localtime
['timezone']['use_symlink'] Boolean whether to use a symlink into the tzdata tree rather than make a copy of the appropriate timezone data file (linux-generic recipe only) false

Usage

Set the "tz" attribute to your desired timezone and include the "timezone-ii" recipe in your node's run list:

{
  "name": "my_node",
  "tz": "Africa/Timbuktu",
  "run_list": [
    "recipe[timezone-ii]"
  ]
}

timezone-ii::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 others). Then it will call one of the recipes below according to your node's platform.

timezone-ii::debian

This changes the timezone on Debian and Debian-derived systems by:

  1. writing the value of tz to /etc/timezone, then
  2. calling dpkg-reconfigure tzdata.

Only the tz attribute is used; all others are ignored.

timezone-ii::fedora

This changes the timezone on Fedora by calling timedatectl set-timezone with the value of tz.

Only the tz attribute is used; all others are ignored.

timezone-ii::linux-generic

This changes the time on all other OSs. 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:

  1. verifies that the value of tz corresponds with a timezone data file under the directory specified in timezone.tzdata_dir (default: /usr/share/zoneinfo), then
  2. 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.

Contributing

  1. Fork the repository on GitHub
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. If at all possible, write test-kitchen tests for your change and ensure they all pass
  5. Submit a pull request using GitHub

License and Authors

Copyright © 2010 James Harton [email protected]

Copyright © 2013 Lawrence Leonard Gilbert [email protected]

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.