Ask Your Question

How to change username of installed files after RPM installation using puppet?

asked 2018-02-26 04:10:11 -0600

Murugan R gravatar image

I'm new to puppet, I need to build a RPM for set of libraries in such a way that i build and compile it in DEV server and this RPM need to be installed in other Server also like QA,PROD,UAT and these servers has different user names, so i need to build my RPM to contain and pick username for respective server during installation, can this be achieved using the chown,chgrp in the puppet script? Something like this

exec {"chown newuser:newgroup /directory1/directory2/; chown newuser:newgroup /directory3/directory4/file name.bsh"; }

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-05-04 04:39:43 -0600

updated 2018-05-04 04:41:32 -0600

You can use file resources without specifying any source or content attribute:

file {
    owner   => 'newuser',
    group   => 'newgroup',
    require => Package['my_package'],
  ['/directory0/directory1/', '/directory0/directory2/']:
    ensure  => directory,
  ['/directory2/directory3/file', '/directory2/directory3/name.bsh']:
    ensure  => present,

The construct with default is known as per-expression default attributes. You obviously want to set require => Package['foo'] since Puppet itself does not create the files, but your package (resource) does.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-02-26 04:10:11 -0600

Seen: 43 times

Last updated: May 04