Using Chef 11.4, I am trying to get vagrant up to set an environment variable. Specifically, the TZ env variable that sets the VM's timezone.
It works fine manually, if I vagrant ssh then type export TZ=America/Los_Angeles then type date I see the time in West Coast time zone (as opposed to ubuntu's default UTC).
But I cannot figure out how to effective run export TZ=America/Los_Angeles within Vagrantfile so it executes when I run vagrant up
I've tried it 3 different ways, including attempting to write it to the .profile file. None of them work. (Th e.profile file does not get edited, and the TZ variable does not get set.
config.vm.provision :shell, inline: %q{export TZ=America/Los_Angeles}
config.vm.provision :shell, inline: %q{sudo bash -c "export TZ=America/Phoenix" >> ~/.profile}
config.vm.provision :shell, inline: %q{echo "export TZ=America/New_york" >> ~/.profile}
the output after running vagrant up is:
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
But the environment variable does not get set directly, nor does the .profile fiel get edited