user3382991
user3382991

Reputation: 21

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?

Upvotes: 1

Views: 146

Answers (1)

Alvaro
Alvaro

Reputation: 2327

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). If you don't specify a source attribute you won't get the diffs you are expecting, since there is nothing to compare with.

If you only want to be warned about changes in that directory you can use the audit attribute. 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

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.

Upvotes: 1

Related Questions