With Puppet you can set Resource Default Statments:
File {
backup => '.puppet-bak',
ensure => present,
group => 'root',
mode => '644',
owner => 'root',
}
and if I later have a file
such as this it will inherit the default settings defined above.
file { '/etc/postfix/main.cf':
source => "$file_root/etc/postfix/main.cf"
}
Is the same, or similar, possible with Salt to avoid a ton of duplicate code? How?
Currently, it is not possible to set default resources like in puppet. The feature was approved, but there seems to be no information on if it was implemented yet. https://github.com/saltstack/salt/issues/6405
My suggestion is to use figure how to use jinja templating to satisfy this need.