I've just realized that my problem statement was slightly misleading. A 
'users' file gets installed as part of the software package, and the  
goal is replacing its contents during the first Puppet run. The next 
Puppet runs should ignore any changes.


On Thu, 2021-01-28 at 20:07 +0100, Martin Alfke wrote:
> and please use ensure => file !
> this is more clear.
> you can set the file ensure attribute to one of the following: file, 
> directory, link, absent
> 
> 
> > On 28. Jan 2021, at 18:58, Ben Ford <ben.f...@puppet.com> wrote:
> > 
> > Yep, just use the replace attribute on the file resource. 
> > https://puppet.com/docs/puppet/latest/types/file.html#file-attribute-replace
> > 
> > On Thu, Jan 28, 2021 at 9:57 AM Steve McKuhr <steve.mck...@gmail.com> wrote:
> > I'd like to initialize a user config file once, at software install time, 
> > then allow application admins to manage the file contents via web interface 
> > (add/remove users, etc.) - I have come up with the following:
> > 
> > file { 'users':
> >   ensure => present,
> >   content => template('my-template'),
> >   validate_cmd => '/bin/test ! -f users.control',
> > }
> > file { 'users.control':
> >   ensure => present,
> >   content => "puppet managed",
> >   require => File['users'],
> > }
> > 
> > The above code works ok, however I was wondering if there is a more elegant 
> > solution.
> > 
> > Thanks,
> > Steve
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Puppet Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to puppet-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/puppet-users/fb1ae2b4-f220-4d18-864b-aafbadb44b14n%40googlegroups.com.
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Puppet Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to puppet-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/puppet-users/CACkW_L5oTmsHiwvmVEisKap7gkUt1P4Gmvh1-%3DBQqNtHHiWAcA%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/4cb67533a96456e7761973336db2eb2f96dc3e1e.camel%40gmail.com.

Reply via email to