本文介绍了如何使用Vagrant,Puppet和Hiera配置时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在基于Vagrant/Puppet + Hiera的测试环境中使用 PuPHPet .

I'm using PuPHPet for my testing environments, which is based on Vagrant/Puppet+Hiera.

在config.yml(Hiera配置文件)中,我想添加我的时区部分

In the config.yml (Hiera config file) I would like to add section for my timezone

,并使用命令对其进行正确设置.

and with command setup it properly.

有可能吗?

推荐答案

只需将您的时区添加到您的hiera文件中所需的任何键上,我们将其称为timezone.设置该时区所需的值和木偶代码取决于要启动的系统,但我将假设使用RedHat Unix风格.

Just add your timezone to whatever key you want in your hiera file, let's call it timezone. The value for which and the puppet code you'd need to set that timezone depends on the system you're firing up, but I'll assume RedHat flavor of unix.

我建议将其设置为您在/usr/share/zoneinfo下看到的任何有效值.例如,您的密钥可能如下所示:

I recommend setting that to any valid value you'd see under /usr/share/zoneinfo. As an example your key may look like:

timezone: 'US/Pacific'

然后,您将使用file人偶类型将/etc/localtime符号链接到时区的完整路径:

Then you'd use the file puppet type to symlink /etc/localtime to the full path of the timezone:

$tz = hiera('timezone')
file {'/etc/localtime': ensure => link, target => "/usr/share/zoneinfo/${tz}"}

这篇关于如何使用Vagrant,Puppet和Hiera配置时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 02:33