FAQ
I've been looking around but can't seem to find an answer to this.

I would like to create a file whose initial contents come from the default
in the puppet server but is subsequently modifiable and puppet won't
overwrite any changes.

The reason for this is that if I deploy a user account via puppet and
upload a default .bashrc/.profile, the user should be able to modify these
without having puppet change them back to the originals every time it runs.

Thanks

Paul

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/MNccQWibusoJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Peter Brown at Oct 9, 2012 at 5:27 am
    Hi,

    The best way to do that is to modify the system skeleton files and
    make sure useradd is using them.
    They get put in user homedirs when the account gets created.
    On 9 October 2012 15:19, pdurkin wrote:
    I've been looking around but can't seem to find an answer to this.

    I would like to create a file whose initial contents come from the default
    in the puppet server but is subsequently modifiable and puppet won't
    overwrite any changes.

    The reason for this is that if I deploy a user account via puppet and upload
    a default .bashrc/.profile, the user should be able to modify these without
    having puppet change them back to the originals every time it runs.

    Thanks

    Paul

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/MNccQWibusoJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Pdurkin at Oct 9, 2012 at 5:54 am
    Thanks, that solves the problem I posted however there were several
    situations where I would like to be able to upload a file and after that
    not care about it.

    Another example I was wrestling with was uploading a tar.gz then allowing
    it to be removed afterwards. I want it uploaded so that I can deploy the
    contents but once it's there I would like puppet (or some admin) to clean
    it up later.

    Is it possible then I should be running an exec to copy the file from the
    server and use the unless (file exists already)?

    thanks

    Paul
    On Tuesday, October 9, 2012 9:27:05 AM UTC+4, Pete wrote:

    Hi,

    The best way to do that is to modify the system skeleton files and
    make sure useradd is using them.
    They get put in user homedirs when the account gets created.
    On 9 October 2012 15:19, pdurkin <pdur...@gmail.com <javascript:>> wrote:
    I've been looking around but can't seem to find an answer to this.

    I would like to create a file whose initial contents come from the default
    in the puppet server but is subsequently modifiable and puppet won't
    overwrite any changes.

    The reason for this is that if I deploy a user account via puppet and upload
    a default .bashrc/.profile, the user should be able to modify these without
    having puppet change them back to the originals every time it runs.

    Thanks

    Paul

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/MNccQWibusoJ.
    To post to this group, send email to puppet...@googlegroups.com<javascript:>.
    To unsubscribe from this group, send email to
    puppet-users...@googlegroups.com <javascript:>.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/R-X_u_Jk4zgJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Peter Brown at Oct 9, 2012 at 6:16 am

    On 9 October 2012 15:54, pdurkin wrote:
    Thanks, that solves the problem I posted however there were several
    situations where I would like to be able to upload a file and after that not
    care about it.

    Another example I was wrestling with was uploading a tar.gz then allowing it
    to be removed afterwards. I want it uploaded so that I can deploy the
    contents but once it's there I would like puppet (or some admin) to clean it
    up later.
    If there are system config file in those archives it would be better
    to manage them with puppet.
    If you are deploying applications I find it's better to use git or svn
    to manage the code for the application because you get versioning and
    rollback options.
    Is it possible then I should be running an exec to copy the file from the
    server and use the unless (file exists already)?
    Why can't you just manage the file with the file resource?
    I am pretty sure there is an option that won't overwrite a file if it exists.
    Please read the docs for the file resource to confirm.
    thanks

    Paul

    On Tuesday, October 9, 2012 9:27:05 AM UTC+4, Pete wrote:

    Hi,

    The best way to do that is to modify the system skeleton files and
    make sure useradd is using them.
    They get put in user homedirs when the account gets created.
    On 9 October 2012 15:19, pdurkin wrote:
    I've been looking around but can't seem to find an answer to this.

    I would like to create a file whose initial contents come from the
    default
    in the puppet server but is subsequently modifiable and puppet won't
    overwrite any changes.

    The reason for this is that if I deploy a user account via puppet and
    upload
    a default .bashrc/.profile, the user should be able to modify these
    without
    having puppet change them back to the originals every time it runs.

    Thanks

    Paul

    --
    You received this message because you are subscribed to the Google
    Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/MNccQWibusoJ.
    To post to this group, send email to puppet...@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users...@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/R-X_u_Jk4zgJ.

    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Paul Tötterman at Oct 9, 2012 at 6:26 am
    Is it possible then I should be running an exec to copy the file from the
    server and use the unless (file exists already)?

    exec { 'foobar':
    command => '/usr/bin/wget https://... -O /file/location',
    creates => '/file/location',
    }

    Cheers,
    Paul

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/8eoG3rgnbIcJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Peter Brown at Oct 9, 2012 at 6:33 am

    On 9 October 2012 16:26, Paul Tötterman wrote:
    Is it possible then I should be running an exec to copy the file from the
    server and use the unless (file exists already)?
    exec { 'foobar':
    command => '/usr/bin/wget https://... -O /file/location',
    creates => '/file/location',
    }
    This is not really the best way to manage a file in puppet.
    Cheers,
    Paul

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/8eoG3rgnbIcJ.

    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • David Schmitt at Oct 9, 2012 at 7:38 am
    Use file's replace => false parameter.

    See http://docs.puppetlabs.com/references/latest/type.html#file


    Fun, D.
    On 09.10.2012 07:19, pdurkin wrote:
    I've been looking around but can't seem to find an answer to this.

    I would like to create a file whose initial contents come from the
    default in the puppet server but is subsequently modifiable and puppet
    won't overwrite any changes.

    The reason for this is that if I deploy a user account via puppet and
    upload a default .bashrc/.profile, the user should be able to modify
    these without having puppet change them back to the originals every time
    it runs.

    Thanks

    Paul

    --
    You received this message because you are subscribed to the Google
    Groups "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/MNccQWibusoJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Mason Turner at Oct 9, 2012 at 10:53 am
    That is the intent of "ensure => present". If the file isn't there, puppet will create it with the source/content parameter. If it is there (exists), puppet will leave it alone.

    http://docs.puppetlabs.com/references/latest/type.html#file

    — Mason Turner
    On Oct 9, 2012, at 1:19 AM, pdurkin wrote:

    I've been looking around but can't seem to find an answer to this.

    I would like to create a file whose initial contents come from the default in the puppet server but is subsequently modifiable and puppet won't overwrite any changes.

    The reason for this is that if I deploy a user account via puppet and upload a default .bashrc/.profile, the user should be able to modify these without having puppet change them back to the originals every time it runs.

    Thanks

    Paul
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/MNccQWibusoJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jcbollinger at Oct 9, 2012 at 1:10 pm

    On Tuesday, October 9, 2012 12:19:20 AM UTC-5, pdurkin wrote:
    I've been looking around but can't seem to find an answer to this.

    I would like to create a file whose initial contents come from the default
    in the puppet server but is subsequently modifiable and puppet won't
    overwrite any changes.
    This is exactly what the File resource type's 'replace' parameter is for.

    file { '/etc/foo.conf'':
    ensure => 'file',
    source => 'puppet:///mymodule/foo.conf',
    replace => false
    }

    That will install the file (as a copy from the specified source, in the
    above example) if it does not already exist, but it will not modify an
    existing file.


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/X2arwvJI_ZsJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Pdurkin at Oct 10, 2012 at 6:32 am
    Thanks for all the help, the two solutions + using them both together will
    solve all the situations I'm considering.

    Paul
    On Tuesday, October 9, 2012 9:19:20 AM UTC+4, pdurkin wrote:

    I've been looking around but can't seem to find an answer to this.

    I would like to create a file whose initial contents come from the default
    in the puppet server but is subsequently modifiable and puppet won't
    overwrite any changes.

    The reason for this is that if I deploy a user account via puppet and
    upload a default .bashrc/.profile, the user should be able to modify these
    without having puppet change them back to the originals every time it runs.

    Thanks

    Paul
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/CDzGG-naGVUJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 9, '12 at 5:23a
activeOct 10, '12 at 6:32a
posts10
users6
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase