File Manipulation Approaches
Software/script => have you considered packaging it?
binary/large data file => add metadata (git + vcsrepo
type, maybe even git-annex
or git-lfs
?)
Puppet >= 3.7:
file { 'foo' :
content => file (' <module>/<file>' )
}
file { 'foo' :
source => ' puppet:///modules/<module>/<file>'
}
there exists a Puppet purgeable type for the format (host
, mailalias
, augeasproviders , etc.) => use it with purge :
host { 'foo' :
ensure => present ,
}
resources { 'host' :
purge => true
}
file { 'foo' :
content => template (),
}
content from various scopes:
the application supports conf.d
directory/includes => conf.d/
directory + purge
otherwise => concat module (puppetlabs or theforeman)
content from example file on the agent + modifications => augeas_file
there is a Puppet type for the format (host
, mailalias
, augeasproviders, etc.) => use it!
the application supports conf.d
directory/includes => conf.d/
directory with file
resources
it is an IniFile type of file => use ini_setting
there is an Augeas lens for the format => use the augeas
type
are you actually trying to patch a script? => you should fork/patch/repackage it, really!
you only want to modify one line of a file format nobody else knows about => file_line