简体   繁体   English

在人偶中指定来源

[英]Specifying a source in puppet

I am writing a puppet manifest on puppet master to monitor a folder with a list of files on a agent. 我在人偶主控上编写人偶清单以监视包含代理程序中文件列表的文件夹。

I do not know how do i specify a remote value for the "source" attribute of my file resource type, since the folder is located on agent and i do not want to copy the folder with its content on my master since that would unnessaryly utillize some space. 我不知道如何为我的文件资源类型的“源”属性指定一个远程值,因为该文件夹位于代理上,并且我不想将其内容复制到我的主文件夹上,因为这会不必要地利用一些空间。

file { '/XYZ/ybc/WebSphere85dev/AppServer/properties':
ensure  => directory,
owner   => wsuser,
group   => webapp,
source  => "??????",
recurse => true,
show_diff => true,

What value should i specify for source? 我应该为来源指定什么值?

If you specify a source , the file resource that you have created will be synced with the source (it can be in the master, or in the agent node), and the diffs will be present in the puppet report (it's the default, you don't need the show_diff attribute). 如果指定source ,则创建的file资源将与source同步(可以在主节点或代理节点中),并且差异将出现在木偶报告中(默认情况下,您可以不需要show_diff属性)。 If you don't specify a source attribute you won't get the diffs you are expecting, since there is nothing to compare with. 如果不指定source属性,则不会获得期望的差异,因为没有可比较的内容。

If you only want to be warned about changes in that directory you can use the audit attribute. 如果只想警告该目录中的更改,则可以使用audit属性。 However, you won't get the diffs that you are expecting, just a message saying that the contents have changed (again, there's nothing to compare): 但是,您不会得到所期望的差异,仅显示一条消息,内容已更改(再次,没有可比较的内容):

file {
    '/XYZ/ybc/WebSphere85dev/AppServer/properties':
        ensure    => directory,
        audit     => content,
        recurse   => true,
        show_diff => true,
}

You can specify all , any attribute or array of attributes to be audited: http://docs.puppetlabs.com/references/latest/metaparameter.html#audit 您可以指定all ,任何属性或要审核的属性数组: http : //docs.puppetlabs.com/references/latest/metaparameter.html#audit

Also, bear in mind that with the manifest that you posted you are changing the owner and group of the directory /XYZ/ybc/WebSphere85dev/AppServer/properties and its contents. 另外,请记住,使用您发布的清单,您正在更改目录/XYZ/ybc/WebSphere85dev/AppServer/properties及其内容的ownergroup

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM