Code Monkey home page Code Monkey logo

vagrant-timezone's Introduction

Time Zone Configuration Plugin for Vagrant

Gem Version Build Status

A Vagrant plugin that configures the time zone of a virtual machines.

If you want to use a specific time zone in a Vagrant VM, or if a third party base box comes with a non-standard time zone, this plugin is to the rescue. The configuration is done on vagrant up and vagrant reload actions. Note that no services are restarted automatically so they may keep using the old time zone information.

Usage

Install the plugin:

vagrant plugin install vagrant-timezone

To configure time zone for all Vagrant VMs, add the following to $HOME/.vagrant.d/Vagrantfile (or to a project specific Vagrantfile):

Vagrant.configure("2") do |config|
  if Vagrant.has_plugin?("vagrant-timezone")
    config.timezone.value = "UTC"
  end
  # ... other stuff
end

The value can be anything that the tz database supports (the "TZ" column). For example "UTC" or "Europe/Helsinki".

For Windows guests the value can be a name in this table, or "Etc/GMT<offset>" (like with the :host value, see the next chapter).

Matching the Host Timezone

If the special symbol :host is passed at the parameter (config.timezone.value = :host), the plugin will attempt to set the guest timezone offset to match the current offset of the host. Because of limitations in Ruby's ability to get the named timezone from the host, it will instead convert the host's timezone offset to a calculated offset from UTC. So for example, on the west coast of the USA the calculated timezone might be Etc/GMT+8. After a change in the host's timezone (including a change due to Daylight Savings Time taking effect), the next time the Vagrantfile is run the guest clock will be updated to match. Note that this functionality has only been tested with an OS X host and Linux guest.

Compatibility

This plugin requires Vagrant 1.2 or newer (downloads).

The plugin is supposed to be compatible with all Vagrant providers and other plugins. Please file an issue if this is not the case.

At the moment the supported platforms include:

  • All Linux guests. Confirmed at least:

    • Arch
    • CoreOS
    • Debian (and derivatives)
    • Gentoo
    • RedHat (and derivatives)
  • All BSD guests:

    • FreeBSD
    • NetBSD
    • OpenBSD
    • OS X
  • Windows

Development

As Vagrant bundles Ruby, the same version should be used when developing this plugin. For example Vagrant 1.9 comes with Ruby 2.2.

vagrant-timezone's People

Contributors

tmatilai avatar corbt avatar rcoup avatar

Watchers

James Cloos avatar  avatar

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.